im rotating an object using:
rb.AddTorque(-turnInput);
but i cant work out how to make it stop adding torque when it gets to a certain level
i mad a float variable maxTorque
but cant work out how to capture what the actual torque level is do do an if
any help appreciated
when you add torque it changes the angularVelocity.
What you want to do is set a maximum angularVelocity for your object after adding the torque:
float maxAngularVelocity = 10f;
rb.AngularVelocity = Vector3.ClampMagnitude(rg.AngularVelocity, maxAngularVelocity);
Wow thanks PraetorBlue giving it a go now!
cool solved it like this
if (rb.angularVelocity < maxAngularVelocity && rb.angularVelocity > -maxAngularVelocity)
{
rb.AddTorque(-turnInput);
}