Calculate Animation Position and rotation


image
RS0 is the red part and RS1 is the blue part. I need the red part to be positioned exactly the same as the blue part since I can’t do this with Roblox’s animation editor.
I have tried this code:

-- p0 * C0 == p1 * C1 * Transform
-- C1:Inverse() * p1:Inverse() * p0 * C0 == Transform
local char = workspace["doing animatiosn"].plasma_gunner_animations
local joint = char.Gear.RevolverRS0.Joint
local to_cf = char.Gear.RevolverRS1.CFrame
local t = joint.C1:Inverse() * to_cf:Inverse() * joint.Part0.CFrame * joint.C0

print(t.Position)
print(Vector3.new(t:ToOrientation()) * 180/math.pi)

Blue part/RS1 is connected to the LeftHand, and the red part/RS0 is connected to the UpperTorso

I figured it out I had the equation wrong.

This is supposed to be

-- right eq:
-- p0 * C0 * Transform == p1 * C1

Also needed to use :ToEulerAnglesXYZ() instead of :ToOrientation

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.