I was trying to make a camera that’s relative to the character, for a robot combat game like Zone of the Enders, Project Nimbus, Strike Suit Zero/Infinity, etc. and I can’t get rotation/localRotation to work properly.
float hor = Input.GetAxis("Mouse X") * smooth;
float ver = Input.GetAxis("Mouse Y") * smooth;
/*
if(!target.IsGrounded())
target.transform.Rotate(-ver, hor, 0);
else
target.transform.Rotate(0, hor, 0);
*/
/*
if(!target.IsGrounded())
target.transform.localRotation = Quaternion.Euler(-ver, hor, 0);
else
target.transform.localRotation = Quaternion.Euler(0, hor, 0);
*/
The target is a GameObject. The grounding is irrelevant. If I use Rotate, it rotates ‘alright’, but not how I want to. If I use rotation/localRotation, it rotates, but only for 1 frame, then returns to the default position. transform.eulerAngles does the same thing. Even if I make an empty game object that is supposed to just exist and spin something by its local rotation, it will not.
I am pretty new to Unity, not new to coding so it doesn’t make sense to me how this doesn’t work. Please help.