x


What can I do to prevent momentum?

I have an aeroplane that I can control. However, when it turns, it takes a while for its momentum to recede. If the plane turns in the opposite direction it flys backwards for a while before slowing and accelerating forward. This is extremely unrealistic, but I am new to Unity and can't figure it out.

var maxTorque : float = 10.0f;
var forwardForce : float = 10.0f;

var currentTorqueHor : float = 0.0f;
var currentTorqueVer : float = 0.0f;
var currentTorqueBank : float = 0.0f;

function Update()
{
    currentTorqueHor = maxTorque * Input.GetAxis("Horizontal"); 
    currentTorqueVer = maxTorque * Input.GetAxis("Vertical");
    currentTorqueBank = maxTorque * Input.GetAxis("Bank");
    }

function FixedUpdate()
{   
    rigidbody.AddForce(transform.forward * forwardForce);
    rigidbody.AddRelativeTorque(currentTorqueVer, currentTorqueBank, -currentTorqueHor);
}
more ▼

asked Apr 13 '11 at 11:25 PM

Max 4 gravatar image

Max 4
254 60 64 71

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x68
x24
x21

asked: Apr 13 '11 at 11:25 PM

Seen: 528 times

Last Updated: Apr 13 '11 at 11:25 PM