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);
}
asked
Apr 13 '11 at 11:25 PM
Max 4
254
●
60
●
64
●
71