I’ve given a gameObject a constant force so he moves forwards (he’s a fighter jet). I want him to turn realistically and move in the new direction he’s facing, so he flies the right way.
Is there a way to calculate what AddTorque you need to give an object to get him to face a particular direction (without using rigidbody.MoveRotation) ??
Without some math in your code, i dont think there is a straight function to “look at a target” with the AddTorque function, you can calculate the direction to rotate to with basic vector math and stop adding force when the angle between the 2 is zero. Take a look at the Vector3.Dot function!
The problem is that he just spins in circles increasing his torque as he goes… I need to directly affect the overall angularvelocity of the gameObject maybe? Does anyone have any ideas?
Yes, it does keep spinning, you gave it a direction, so it goes towards it, but you didn’t tell it to stop when it is facing it. Look HERE, use vector3.Dot to stop the force to rotate when they are perpendicular, which is the vector.Dot prodcut = 0