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

Motor6D not pointing to where I want it to point?

Asked by 4 years ago

I am using c0 to rotate the character's arm toward the mouse location. It works as wanted when the character is facing towards the negative z axis, but when I change the direction I am facing, the arm starts to point at different places. Here is my code:

shoulder.C0 = CFrame.new(shoulder.C0.p, mouse.Hit.p)
local angle = CFrame.Angles(math.rad(90), 0, 0)
shoulder.C0 = shoulder.C0:ToWorldSpace(angle)

(shoulder is the RightShoulder joint)

Answer this question