mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
[IKFixes] Movement Parent IK handling now respects new orientation mode.
This commit is contained in:
parent
6b32a6475d
commit
d1547e2e92
2 changed files with 8 additions and 6 deletions
|
@ -296,13 +296,15 @@ internal static class PlayerSetupPatches
|
||||||
currentPosition.y = IKSystem.vrik.transform.position.y; // set pivot to floor
|
currentPosition.y = IKSystem.vrik.transform.position.y; // set pivot to floor
|
||||||
Quaternion currentRotation = Quaternion.Euler(0f, currentParent.transform.rotation.eulerAngles.y, 0f);
|
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
|
// 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);
|
IKSystem.vrik.solver.AddPlatformMotion(deltaPosition, deltaRotation, currentPosition);
|
||||||
BodySystemPatches.OffsetSimulatedRootAngle(deltaRotation.eulerAngles.y);
|
BodySystemPatches.OffsetSimulatedRootAngle(deltaRotation.eulerAngles.y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,6 @@
|
||||||
],
|
],
|
||||||
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r21/IKFixes.dll",
|
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r21/IKFixes.dll",
|
||||||
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/IKFixes/",
|
"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"
|
"embedcolor": "f46e49"
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue