- Home /
Replicate rotation of Camera
I have an FPS camera- and I want the character to follow the camera movements: similar to the way it does in Minecraft; with the head follow the X rotation and the entire player following the Y rotation.
I have the code to make the entire player follow the Target (the camera) rotation (in C#):
rotation.eulerAngles = Vector3(0f, Target.rotation.y, 0f);
But it kicks up an error along the lines of expression donates a type, where a 'variable', 'value', pr 'method group' was expected.
How would I achieve this?
Comment
Answer by whydoidoit · Nov 17, 2012 at 11:28 PM
That code should be:
rotation.eulerAngles = new Vector3(0f, Target.rotation.eulerAngles.y, 0f);
I wrote an article on Quaternions and Rotations on Unity Gems that might be useful to you.