So basically, I set up a script where the arms follow the mouse in the Y-scale (using the shoulder motor6Ds), but I cannot seem to move the arms properly facing the mouse.
This was my closest attempt to doing so, but I noticed a bit of a problem; the arms are facing the mouse in the wrong angle, and only align when I move the mouse to the front or the back of the character.
https://gyazo.com/02952a558a916f9f5ce684a8878b7540
This is the code that I use to move the arms (ran every frame when the character currently has an equipped tool) :
RightShoulder.C0 = RightShoulder.C0:lerp((Character.Head.CFrame * CFrame.new(1, -1, 0)):toObjectSpace(CFrame.new(Vector3.new(HRP.Position.X, HRP.Position.Y, HRP.Position.Z), Vector3.new(playerMouse.Hit.p.X, HRP.Position.Y, playerMouse.Hit.p.Z))):inverse() * CFrame.Angles(0, math.pi/2, 0), 1/2)
LeftShoulder.C0 = LeftShoulder.C0:lerp((Character.Head.CFrame * CFrame.new(-1, -1, 0)):toObjectSpace(CFrame.new(Vector3.new(HRP.Position.X, HRP.Position.Y, HRP.Position.Z), Vector3.new(playerMouse.Hit.p.X, HRP.Position.Y, playerMouse.Hit.p.Z))):inverse() * CFrame.Angles(0, -math.pi/2, 0), 1/2)
I have tried multiplying the CFrame, wrapped in toObjectSpace()
, with a CFrame.Angles, but that only seems to move where they properly align.
If anyone could help with my issue, that would be appreciated!
(also if this confuses you a bit, I’m sorry. I tried my best to explain)