Im using an R6 character and I am trying to make a script that rotates the players head in the direction of the camera. I have it working on the X axis aka looking up and down but I cant get the rotation working for looking side to side.

Heres my code

Character.Torso.Neck.C0 = CFrame.new(0, 1, 0) * CFrame.Angles(math.asin(Camera.CFrame.LookVector.Y) + math.pi/2, math.pi, math.asin(Camera.CFrame.LookVector.Z) + math.pi/2) 

I have attempted the left and right rotation but it is offset.

Heres a gif https://gyazo.com/1fcd7d9918006be5cf5f191d353c1085

Thank you for your time :)

2 comments

0

The X and Z axes are what you need to control to make the head follow the camera correctly. The Y axis is the vertical axis.

0

Bro if I switch the first one to anything but Y it wont work. Im more focused on the second part, because the 2nd part is the part that isnt working.