- Home /
Question by
unity_T8ypJWCXL20Hiw · Aug 13, 2018 at 08:57 AM ·
rotationpositionquaternion
Unity camera follows player rotation
Hi, I want my camera to follow the player rotation but the camera should always have an angle to the player. I have this:
transform.rotation = player.transform.rotation;
But now the Camera looks straight at the player and not at an angle from above. How can I add my wanted angle to the rotation? Thanks for your help!
Comment
Best Answer
Answer by IvovdMarel · Aug 13, 2018 at 09:10 AM
The easiest way to have the camera follow the position and rotation of another object is to make it a child of that object.
If you really only want to follow the rotation and add an offset I would go for
transform.rotation = player.transform.rotation + Quaternion.Euler(45,0,0);
Quaternion.Euler(45,0,0);
works perfectly fine but you have to use a * and not a + :) Thanks for your help!