[IKFixes] Movement Parent IK handling now respects new orientation mode.

This commit is contained in:
NotAKidoS 2023-09-23 19:36:06 -05:00
parent 6b32a6475d
commit d1547e2e92
2 changed files with 8 additions and 6 deletions

View file

@ -296,13 +296,15 @@ internal static class PlayerSetupPatches
currentPosition.y = IKSystem.vrik.transform.position.y; // set pivot to floor
Quaternion currentRotation = Quaternion.Euler(0f, currentParent.transform.rotation.eulerAngles.y, 0f);
// Convert to delta position (how much changed since last frame)
Vector3 deltaPosition = currentPosition - lastMovementPosition;
Quaternion deltaRotation = Quaternion.Inverse(lastMovementRotation) * currentRotation;
// Prevent targeting previous movement parent
if (lastMovementParent == currentParent || lastMovementParent == null)
if (lastMovementParent != null && lastMovementParent == currentParent)
{
Vector3 deltaPosition = currentPosition - lastMovementPosition;
Quaternion deltaRotation = Quaternion.identity;
if (currentParent.orientationMode == CVRMovementParent.OrientationMode.RotateWithParent)
deltaRotation = Quaternion.Inverse(lastMovementRotation) * currentRotation;
IKSystem.vrik.solver.AddPlatformMotion(deltaPosition, deltaRotation, currentPosition);
BodySystemPatches.OffsetSimulatedRootAngle(deltaRotation.eulerAngles.y);
}

View file

@ -19,6 +19,6 @@
],
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r21/IKFixes.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/IKFixes/",
"changelog": "- Updates for 2023r172\n- Removed unneeded settings (IKPose & NetIKPass).\n- Fixed halfbody fake root angle option.\n- Added Reset Settings UIExpansionKit button.\n- Fixed issue with MelonPref identifiers containing illegal characters.",
"changelog": "- Updates for 2023r172\n- Removed unneeded settings (IKPose & NetIKPass).\n- Fixed halfbody fake root angle option.\n- Added Reset Settings UIExpansionKit button.\n- Fixed issue with MelonPref identifiers containing illegal characters.\n- Movement Parent IK handling now respects new orientation mode.",
"embedcolor": "f46e49"
}