Motor6d lerping between relative CFrame's

Im attempting to make a moon animator 2 file player for ingame cutscenes

problem :
lerping between 2 relative motor6d values is not working correctly

what i do :
each render step i loop trough all predefined keyframes in order of the joint’s layer (how deep it’s connection is in a rig) and lerp them as such:

local desired = (joint.Part0.CFrame * lastValue):Lerp((joint.Part0.CFrame * nextValue), alpha)
joint.C1 = joint.Part0.CFrame:ToObjectSpace(desired)

Im 100% certain that lastValue and nextValue are correct as doing a constant easing works correctly

what it should do:

what it’s doing:

I’ve already tried countless solutions but to no avail

The rotation of the motor6d during lerping causes it to take weird paths

bump, i really need this soon.

this took me over 3 days and countless hours in each.

i found the solution, big thanks to dthecoolest and their post about cframe manipulation

solution:

local default = (joint.Part0.CFrame * joint.C0) -- get the pivot position
local f_last, f_next = default * lastValue:Inverse(), default * nextValue:Inverse() -- multiply the pivot by the inverse of the relative values in order to get a world cframe
local desired = f_last:Lerp(f_next, alpha) -- lerp between the 2 world positions
joint.C1 = desired:Inverse() * default -- multiply the inverse of the desired cframe by the pivot

--[[ Keynotes:
!!! ORDER MATTERS
dont let the multiplication fool you, cframeA * cframeB is not always cframeB * cframeA
i hate motor6d's!
--]]

module: Moon2Cutscene | Play Moon Animator 2 Files - #38 by Hzodx

1 Like

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