Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm having trouble with CFrames. Could someone help?

Asked by
Supint 60
8 years ago

I'm trying to get the head, at least while in first person, to have the exact same rotation at the camera, regardless of which way the Torso is positioned.

The following pieces of code I have tried out do not work. Could someone tell me why, and help me out with this problem?

char.Torso.Neck.C0 = ((CFrame.new(0,1.5,0)*(cam.CoordinateFrame-cam.CoordinateFrame.p)):inverse()*(char.Torso.CFrame-char.Torso.CFrame.p)):inverse()
char.Torso.Neck.C0 = CFrame.new(0, 1.5, 0) * CFrame.Angles(math.asin(camera.CoordinateFrame.lookVector.y), -math.asin(camera.CoordinateFrame.lookVector.x), 0)
    char.Torso.Neck.C1 = CFrame.new()

Answer this question