From 26ef5ef842010702612153ae3ef7756aa09759a2 Mon Sep 17 00:00:00 2001 From: Angeldark Raymaker Date: Sun, 6 Oct 2024 13:07:50 +0100 Subject: [PATCH] FIRE-30873: Add mirroring to position --- indra/newview/fsposeranimator.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/indra/newview/fsposeranimator.cpp b/indra/newview/fsposeranimator.cpp index d1c554eeed..2112c666d2 100644 --- a/indra/newview/fsposeranimator.cpp +++ b/indra/newview/fsposeranimator.cpp @@ -211,7 +211,34 @@ void FSPoserAnimator::setJointPosition(LLVOAvatar *avatar, const FSPoserJoint *j if (!jointPose) return; - jointPose->setTargetPosition(position); + if (style == NONE) + { + jointPose->setTargetPosition(position); + return; + } + + LLVector3 positionDelta = jointPose->getTargetPosition() - position; + + FSPosingMotion::FSJointPose* oppositeJointPose = posingMotion->getJointPoseByJointName(joint->mirrorJointName()); + if (!oppositeJointPose) + return; + + LLVector3 oppositeJointPosition = oppositeJointPose->getTargetPosition(); + switch (style) + { + case SYMPATHETIC: + jointPose->setTargetPosition(position); + oppositeJointPose->setTargetPosition(oppositeJointPosition - positionDelta); + break; + + case MIRROR: + jointPose->setTargetPosition(position); + oppositeJointPose->setTargetPosition(oppositeJointPosition + positionDelta); + break; + + default: + break; + } } LLVector3 FSPoserAnimator::getJointRotation(LLVOAvatar *avatar, FSPoserJoint joint, E_BoneAxisTranslation translation, S32 negation, bool forRecapture)