I can’t seem to figure out why this code is sometimes working and other times not.
Sometimes when i press the key to rotate the object it works, and sometimes it doesn’t.
I just need an object to rotate 180 degrees on z axis. Any help would be appreciated.
code :
if (Input.GetKey(KeyCode.Keypad0)) {
targetRotation = Quaternion.LookRotation(transform.forward, Vector3.right);
transform.rotation = Quaternion.Slerp(targetRotation,transform.rotation, smooth * Time.deltaTime);
}