# Player angle following camera

I'm creating a third-person game. I want the player-model to follow the rotation of the camera. I do that with this :

var camRotation = new Quaternion(cam.rotation.x, cam.rotation.y, cam.rotation.z, cam.rotation.w);
transform.rotation = camRotation;


The horizontal axis works fine, and the model turns with my camera, but the mode vertical axis also tilts up and down, which i do not want.

I've tried zeroing out the rotation.y and z, but this has some strange effects when I do.

• Remember that rotation quaternions are points on a 4-dimensional unit sphere. It doesn't make sense to zero one component of the quaternion, because that rips it off that sphere. In general, you do not want to change individual components of a quaternion by hand — there are really only two operations it makes sense to do that way: inverting a quaternion or rotating to the same orientation in the opposite direction, and the former is clearer to do with Quaternion.Inverse() anyway. – DMGregory Jan 8 at 11:28

var flatForward = camera transform.forward;