|
If I control a spaceship by changing its rotation directly, will that override any change the physics engine would have done? For instance, let's say my ship hits an asteroid, and the physics engine calculates that the front end should be knocked upwards. Would using a control scheme that sets the rotation directly allow the player to negate the torque by engaging the controls in any direction at time of impact?
(comments are locked)
|
|
Yes. You would have to use rigidbody.AddTorque or rigidbody.AddRelativeTorque. Ok then. Would you know how to prevent this issue? http://www.youtube.com/watch?v=NZQ4X1YL1Vo The ship isn't turning on its axis properly. I've tried both of the following with identical results: gameObject.rigidbody.AddRelativeTorque(Vector3.up*PitchYaw*modifier); and gameObject.rigidbody.AddForceAtPosition(-gameObject.transform.right*(PitchYaw*modifier),gameObject.transform.position-(gameObject.transform.forward4)); gameObject.rigidbody.AddForceAtPosition(gameObject.transform.right(PitchYaw*modifier),gameObject.transform.position+(gameObject.transform.forward*4)); The issue only arises when the ship is asymmetrical when viewed in profile relative to the axis of rotation. For instance, the ship in the video pitches up and down just fine. But I can also make a ship that yaws fine, but pitches weird, all based on the symmetry of the colliders that make up the ship. Also, note that I apply the thrusts to the center of gravity (or rather, move the children relative to the top object so that the objects position will be identical to the center of gravity).
May 11 '12 at 07:32 PM
Harabeck
(comments are locked)
|
