I don’t know how to explain it correctly, but basically, I’m trying to mimic the character rotation explained in this tutorial (not the ViewModel, the server part) but only in the arms and head, and regardless of animations that rotate the torso, head, arms, etc.
Currently, I got it perfectly for the head, but not the arms:
I couldn’t record the client on the other side of the screen, I’m sorry.
As you can see the head rotates on the character’s X axis regardless of the torso’s Y rotation, but not the arms, they break their animation pose.
Here’s the current code:
-- Inside the heartbeat function, refer to the end of the linked tutorial
-- (I'm using the motor6D method)
local theta = tiltMotor.CurrentAngle
if math.deg(theta) > 70 or math.deg(theta) < -60 then return end
local _, neckRotationY, _ = upperTorso.CFrame:ToObjectSpace(rootPart.CFrame):ToEulerAnglesXYZ()
neck.C0 = neckC0 * CFrame.Angles(0, neckRotationY, 0) * CFrame.Angles(theta, 0, 0)
neck.C1 = CFrame.new(neck.C1.Position) * CFrame.Angles(0, neckRotationY, 0)
local _, _, rShoulderRotationZ = (upperTorso.CFrame:Inverse() * rUpperArm.CFrame):ToEulerAnglesXYZ()
rShoulder.C0 = rShoulderC0 * CFrame.Angles(0, -rShoulderRotationZ, 0)
rShoulder.C1 = CFrame.new(rShoulder.C1.Position) * CFrame.Angles(-theta, -rShoulderRotationZ, rShoulderRotationZ)
local _, _, lShoulderRotationZ = (upperTorso.CFrame:Inverse() * lUpperArm.CFrame):ToEulerAnglesXYZ()
lShoulder.C0 = lShoulderC0 * CFrame.Angles(0, -lShoulderRotationZ, 0)
lShoulder.C1 = CFrame.new(lShoulder.C1.Position) * CFrame.Angles(-theta, -lShoulderRotationZ, lShoulderRotationZ)
I’m playing with C0 and C1 however I can’t get it working for the arms.
Also, this is what the animation looks like when it’s not broken:
Any help is appreciated.
If you didn’t understand I want the arms to point the gun to where the head is pointing without breaking their animation pose. Rotating them on the character’s X-axis is my guess of what would work because it worked for the head, but if it also breaks the animation that’s not the solution I want.
As I said I don’t know how to explain this problem properly.