Hello.
I’m trying to make my character rotate up to one of the four direction when moving, so that it doesn’t just move up,down,left,right, but it rotates in said direction and moves up, in relation of the camera.
the problem comes when detecting the rotation of the pivot, wich is the camera, here’s the part of the script that doesn’t work:
else if (cameraRotation < 90f || cameraRotation > 274f)
{
Debug.Log("Rotating down");
transform.Rotate(Vector3.up, rotateSpeed);
cameraDirection.transform.Rotate(Vector3.down, rotateSpeed);
}
sometimes it detects properly, but while moving the camera arround it stops doing it.
The rest of the script looks the same with diferent values and it works fine.