I want to reflect a keyframe sequence on a certain axis. I know there are numerous tools that can achieve this such as Moon Animator, but they all flip on the same axis. For example, instead of flipping from left to right, I want to flip the forward axis to back, if that makes sense.
I understand that I could just rotate the animation any direction (180 degrees on the Y axis for my case) to get the desired pose I want, but since I have many animations, it will be difficult.
Is there a way I can modify this module from an animation mirroring plugin to flip along a different axis?
local module = {}
-- Table containing the paired names of the body parts, NOT the names of the joints
module.AlternateParts = {
LeftUpperArm = "RightUpperArm",
LeftLowerArm = "RightLowerArm",
LeftHand = "RightHand",
LeftUpperLeg = "RightUpperLeg",
LeftLowerLeg = "RightLowerLeg",
LeftFoot = "RightFoot",
RightUpperArm = "LeftUpperArm",
RightLowerArm = "LeftLowerArm",
RightHand = "LeftHand",
RightUpperLeg = "LeftUpperLeg",
RightLowerLeg = "LeftLowerLeg",
RightFoot = "LeftFoot",
["Right Arm"] = "Left Arm",
["Left Arm"] = "Right Arm",
["Right Leg"] = "Left Leg",
["Left Leg"] = "Right Leg"
}
-- Private
function module.MirrorPoseCFrame(cf)
local x, y, z, R00, R01, R02, R10, R11, R12, R20, R21, R22 = cf:components()
x = -x
-- R00, R10, R20 (x)
R10 = -R10
R20 = -R20
-- R01, R11, R21 (y)
R01 = -R01
-- R02, R12, R22 (z)
R02 = -R02
return CFrame.new(x, y, z, R00, R01, R02, R10, R11, R12, R20, R21, R22)
end
return module
Code forked from this plugin.