EMotionFX: Pose Subtract node has incorrect math
Describe the bug
When using the Pose Subtract node, it applies the conjugate of the rotation of the base pose to the translation delta. This means that if you want to make an additive animation (for usage with Blend Two Additive), the Pose Subtract node does the wrong thing and ends up weirdly rotated in some cases.
While reading the code of the BlendTreePoseSubtractNode.cpp, I see it calls Pose::MakeRelativeTo, which ends up calling Transform::CalcRelativeTo, which does the weird application of the conjugate of the relativeTo transform to the delta. Checking the commit history, I found that in Amazon Lumberyard this code was changed here: https://github.com/aws/lumberyard/commit/2e3184a7d8e59ba05e5707371b8cb6fe40b0ca60#diff-31087f03b810d55e0284f2d04a4f5c1987180b21c1ac9b2c64402fadff02e6caL105-L109
It used to call the Pose::MakeAdditive function instead of Pose::MakeRelativeTo (which is the exact same, except it doesn't apply the conjugate of rotation to the translation delta). If I revert this change locally (I made a copy of the node that calls MakeAdditive), then I can make additive animations that work fine.
If this behavior is intentional (which seems odd, but perhaps it is useful), I would love to see this configurable either as part of the node or as a separate "Make Additive" node.
Otherwise, we could change the function call from Pose::MakeRelativeTo to Pose::MakeAdditive
Steps to reproduce Steps to reproduce the behavior:
- Grab a pose
- Animate the pose
- Create this animgraph:
┌────────────────────────┐
│ Blend Two Additive │
┌─────────────────┐ │ │
│ Motion │ ┌─────────────────────────────────────► Pose 1 │
│ ├──┤ ┌─────────────────────┐ ┌────► Pose 2 │
│ Base pose │ │ │ Pose Subtract │ │ │ Weight (1) │
└─────────────────┘ │ │ ┼──┘ └────────────────────────┘
└───────► Pose 1 │
┌─────────────────┐ ┌─────► Pose 2 │
│ Motion │ │ └─────────────────────┘
│ └────┘
│ Animated base pose
└─────────────────┘
- Observe how it adds extra rotation to the translations of the additive pose when blended back (it doesn't match)
Expected behavior
The applied additive animation, when applied via Blend Two Additive, should match the input animated pose.
Actual behavior They do not match.
Found in Branch point-release/25102 (but the faulty code exists in latest)
Commit ID from o3de/o3de Repository The issue is introduced by this commit in the Lumberyard repository, which O3DE comes from: https://github.com/aws/lumberyard/commit/2e3184a7d8e59ba05e5707371b8cb6fe40b0ca60
Desktop/Device (please complete the following information):
- Device: PC
- OS: Linux
- Version: NixOS 26.11 (Zokor) x86_64
- CPU: i7-14700K
- GPU: Intel Arc A770
- Memory: 31.04 GiB
Additional context This also happens on Windows, with O3DE release 26.5
Source: o3de/o3de