I have a script that rotates my object which works fine, however, even though the object has rotated it maintains its original orientation. To clarify, I mean the object has rotated around its y axis but its x and z axis’ are still what they were at the start of the game. If the object is rotated 90 degrees around its y axis and I try to use Vector3.Forward, it will move perpendicular to the way its facing, the direction it was facing at the start. Heres the code I used to rotate:
if (Input.GetKey(KeyCode.D) && sailMode > 0)
{
rigidBody.AddTorque(Vector3.up * rotateSpeed * Time.deltaTime, ForceMode.Force);
}
else if (Input.GetKey(KeyCode.A) && sailMode > 0)
{
rigidBody.AddTorque(Vector3.up * -rotateSpeed * Time.deltaTime, ForceMode.Force);
}
Does anyone know how I can stop unity from doing this?