mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 14:59:23 +00:00
[DesktopVRIK] No toes & Testing
This commit is contained in:
parent
00166151f1
commit
cbfc1f39b6
4 changed files with 17 additions and 54 deletions
|
@ -516,10 +516,10 @@ internal class DesktopVRIKSystem : MonoBehaviour
|
||||||
avatarVRIK.AutoDetectReferences();
|
avatarVRIK.AutoDetectReferences();
|
||||||
avatarIKSolver = avatarVRIK.solver;
|
avatarIKSolver = avatarVRIK.solver;
|
||||||
|
|
||||||
VRIKUtils.ConfigureVRIKReferences(avatarVRIK, Setting_UseVRIKToes, Setting_FindUnmappedToes, out bool foundUnmappedToes);
|
VRIKUtils.ConfigureVRIKReferences(avatarVRIK, Setting_UseVRIKToes);
|
||||||
|
|
||||||
// Fix animator issue or non-human mapped toes
|
// Fix animator issue
|
||||||
avatarVRIK.fixTransforms = _vrikFixTransformsRequired || foundUnmappedToes;
|
avatarVRIK.fixTransforms = _vrikFixTransformsRequired;
|
||||||
|
|
||||||
// Default solver settings
|
// Default solver settings
|
||||||
avatarIKSolver.locomotion.weight = 0f;
|
avatarIKSolver.locomotion.weight = 0f;
|
||||||
|
@ -531,16 +531,21 @@ internal class DesktopVRIKSystem : MonoBehaviour
|
||||||
avatarIKSolver.spine.maintainPelvisPosition = 0f;
|
avatarIKSolver.spine.maintainPelvisPosition = 0f;
|
||||||
|
|
||||||
// Body leaning settings
|
// Body leaning settings
|
||||||
avatarIKSolver.spine.neckStiffness = 0.0001f;
|
|
||||||
avatarIKSolver.spine.bodyPosStiffness = 1f;
|
avatarIKSolver.spine.bodyPosStiffness = 1f;
|
||||||
avatarIKSolver.spine.bodyRotStiffness = 0.2f;
|
avatarIKSolver.spine.bodyRotStiffness = 0.2f;
|
||||||
|
// this is a hack, allows chest to rotate slightly
|
||||||
|
// independent from hip rotation. Funny Spine.Solve()->Bend()
|
||||||
|
avatarIKSolver.spine.neckStiffness = 0.0001f;
|
||||||
|
|
||||||
// Disable locomotion
|
// Disable locomotion
|
||||||
|
// Setting velocity to 0 aleviated nameplate jitter issue on remote
|
||||||
avatarIKSolver.locomotion.velocityFactor = 0f;
|
avatarIKSolver.locomotion.velocityFactor = 0f;
|
||||||
avatarIKSolver.locomotion.maxVelocity = 0f;
|
avatarIKSolver.locomotion.maxVelocity = 0f;
|
||||||
avatarIKSolver.locomotion.rootSpeed = 1000f;
|
avatarIKSolver.locomotion.rootSpeed = 1000f;
|
||||||
|
|
||||||
// Disable chest rotation by hands
|
// Disable chest rotation by hands
|
||||||
|
// this fixed Effector, Player Arm Movement, BetterInteractDesktop, ect
|
||||||
|
// from making entire body shake, as well as while running
|
||||||
avatarIKSolver.spine.rotateChestByHands = 0f;
|
avatarIKSolver.spine.rotateChestByHands = 0f;
|
||||||
|
|
||||||
// Prioritize LookAtIK
|
// Prioritize LookAtIK
|
||||||
|
@ -552,6 +557,8 @@ internal class DesktopVRIKSystem : MonoBehaviour
|
||||||
|
|
||||||
// Set so emotes play properly
|
// Set so emotes play properly
|
||||||
avatarIKSolver.spine.maxRootAngle = 180f;
|
avatarIKSolver.spine.maxRootAngle = 180f;
|
||||||
|
// this is different in VR, as CVR player controller is not set up optimally for VRIK.
|
||||||
|
// Desktop avatar rotates 1:1 with _PlayerLocal. VR has a disconnect because you can turn IRL.
|
||||||
|
|
||||||
// We disable these ourselves now, as we no longer use BodySystem
|
// We disable these ourselves now, as we no longer use BodySystem
|
||||||
avatarIKSolver.spine.maintainPelvisPosition = 1f;
|
avatarIKSolver.spine.maintainPelvisPosition = 1f;
|
||||||
|
|
|
@ -26,11 +26,13 @@ public static class BTKUIAddon
|
||||||
|
|
||||||
// Calibration Settings
|
// Calibration Settings
|
||||||
AddMelonToggle(ref desktopVRIKCategory, DesktopVRIK.EntryUseVRIKToes);
|
AddMelonToggle(ref desktopVRIKCategory, DesktopVRIK.EntryUseVRIKToes);
|
||||||
AddMelonToggle(ref desktopVRIKCategory, DesktopVRIK.EntryFindUnmappedToes);
|
|
||||||
|
|
||||||
// Fine-tuning Settings
|
// Fine-tuning Settings
|
||||||
AddMelonToggle(ref desktopVRIKCategory, DesktopVRIK.EntryResetFootstepsOnIdle);
|
AddMelonToggle(ref desktopVRIKCategory, DesktopVRIK.EntryResetFootstepsOnIdle);
|
||||||
|
|
||||||
|
// Funny Settings
|
||||||
|
AddMelonToggle(ref desktopVRIKCategory, DesktopVRIK.EntryProneThrusting);
|
||||||
|
|
||||||
// Body Leaning Weight
|
// Body Leaning Weight
|
||||||
AddMelonSlider(ref desktopVRIKPage, DesktopVRIK.EntryBodyLeanWeight, 0, 1f, 1);
|
AddMelonSlider(ref desktopVRIKPage, DesktopVRIK.EntryBodyLeanWeight, 0, 1f, 1);
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,6 @@ public class DesktopVRIK : MelonMod
|
||||||
public static readonly MelonPreferences_Entry<bool> EntryUseVRIKToes =
|
public static readonly MelonPreferences_Entry<bool> EntryUseVRIKToes =
|
||||||
CategoryDesktopVRIK.CreateEntry("Use VRIK Toes", false, description: "Determines if VRIK uses humanoid toes for IK solving, which can cause feet to idle behind the avatar.");
|
CategoryDesktopVRIK.CreateEntry("Use VRIK Toes", false, description: "Determines if VRIK uses humanoid toes for IK solving, which can cause feet to idle behind the avatar.");
|
||||||
|
|
||||||
public static readonly MelonPreferences_Entry<bool> EntryFindUnmappedToes =
|
|
||||||
CategoryDesktopVRIK.CreateEntry("Find Unmapped Toes", false, description: "Determines if DesktopVRIK should look for unmapped toe bones if the humanoid rig does not have any.");
|
|
||||||
|
|
||||||
public static readonly MelonPreferences_Entry<float> EntryBodyLeanWeight =
|
public static readonly MelonPreferences_Entry<float> EntryBodyLeanWeight =
|
||||||
CategoryDesktopVRIK.CreateEntry("Body Lean Weight", 0.5f, description: "Adds rotational influence to the body solver when looking up/down. Set to 0 to disable.");
|
CategoryDesktopVRIK.CreateEntry("Body Lean Weight", 0.5f, description: "Adds rotational influence to the body solver when looking up/down. Set to 0 to disable.");
|
||||||
|
|
||||||
|
@ -42,7 +39,7 @@ public class DesktopVRIK : MelonMod
|
||||||
CategoryDesktopVRIK.CreateEntry("IK Lerp Speed", 10f, description: "Determines fast the IK & Locomotion weights blend after entering idle. Set to 0 to disable.");
|
CategoryDesktopVRIK.CreateEntry("IK Lerp Speed", 10f, description: "Determines fast the IK & Locomotion weights blend after entering idle. Set to 0 to disable.");
|
||||||
|
|
||||||
public static readonly MelonPreferences_Entry<bool> EntryProneThrusting =
|
public static readonly MelonPreferences_Entry<bool> EntryProneThrusting =
|
||||||
CategoryDesktopVRIK.CreateEntry("Prone Thrusting", false, description: "Allows Body Lean Weight to take affect while crouched or prone.");
|
CategoryDesktopVRIK.CreateEntry("Prone Thrusting", false, description: "Allows Body Lean Weight to take effect while crouched or prone.");
|
||||||
|
|
||||||
public static readonly MelonPreferences_Entry<bool> EntryIntegrationAMT =
|
public static readonly MelonPreferences_Entry<bool> EntryIntegrationAMT =
|
||||||
CategoryDesktopVRIK.CreateEntry("AMT Integration", true, description: "Relies on AvatarMotionTweaker to handle VRIK Locomotion weights if available.");
|
CategoryDesktopVRIK.CreateEntry("AMT Integration", true, description: "Relies on AvatarMotionTweaker to handle VRIK Locomotion weights if available.");
|
||||||
|
@ -92,7 +89,6 @@ public class DesktopVRIK : MelonMod
|
||||||
|
|
||||||
// Calibration Settings
|
// Calibration Settings
|
||||||
DesktopVRIKSystem.Instance.Setting_UseVRIKToes = EntryUseVRIKToes.Value;
|
DesktopVRIKSystem.Instance.Setting_UseVRIKToes = EntryUseVRIKToes.Value;
|
||||||
DesktopVRIKSystem.Instance.Setting_FindUnmappedToes = EntryFindUnmappedToes.Value;
|
|
||||||
|
|
||||||
// Fine-tuning Settings
|
// Fine-tuning Settings
|
||||||
DesktopVRIKSystem.Instance.Setting_ResetFootsteps = EntryResetFootstepsOnIdle.Value;
|
DesktopVRIKSystem.Instance.Setting_ResetFootsteps = EntryResetFootstepsOnIdle.Value;
|
||||||
|
|
|
@ -5,23 +5,16 @@ namespace NAK.DesktopVRIK;
|
||||||
|
|
||||||
public static class VRIKUtils
|
public static class VRIKUtils
|
||||||
{
|
{
|
||||||
public static void ConfigureVRIKReferences(VRIK vrik, bool useVRIKToes, bool findUnmappedToes, out bool foundUnmappedToes)
|
public static void ConfigureVRIKReferences(VRIK vrik, bool useVRIKToes)
|
||||||
{
|
{
|
||||||
foundUnmappedToes = false;
|
|
||||||
|
|
||||||
//might not work over netik
|
//might not work over netik
|
||||||
FixChestAndSpineReferences(vrik);
|
//FixChestAndSpineReferences(vrik);
|
||||||
|
|
||||||
if (!useVRIKToes)
|
if (!useVRIKToes)
|
||||||
{
|
{
|
||||||
vrik.references.leftToes = null;
|
vrik.references.leftToes = null;
|
||||||
vrik.references.rightToes = null;
|
vrik.references.rightToes = null;
|
||||||
}
|
}
|
||||||
else if (findUnmappedToes)
|
|
||||||
{
|
|
||||||
//doesnt work with netik, but its toes...
|
|
||||||
FindAndSetUnmappedToes(vrik, out foundUnmappedToes);
|
|
||||||
}
|
|
||||||
|
|
||||||
//bullshit fix to not cause death
|
//bullshit fix to not cause death
|
||||||
FixFingerBonesError(vrik);
|
FixFingerBonesError(vrik);
|
||||||
|
@ -41,41 +34,6 @@ public static class VRIKUtils
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void FindAndSetUnmappedToes(VRIK vrik, out bool foundUnmappedToes)
|
|
||||||
{
|
|
||||||
foundUnmappedToes = false;
|
|
||||||
|
|
||||||
Transform leftToes = vrik.references.leftToes;
|
|
||||||
Transform rightToes = vrik.references.rightToes;
|
|
||||||
|
|
||||||
if (leftToes == null && rightToes == null)
|
|
||||||
{
|
|
||||||
leftToes = FindUnmappedToe(vrik.references.leftFoot);
|
|
||||||
rightToes = FindUnmappedToe(vrik.references.rightFoot);
|
|
||||||
|
|
||||||
if (leftToes != null && rightToes != null)
|
|
||||||
{
|
|
||||||
vrik.references.leftToes = leftToes;
|
|
||||||
vrik.references.rightToes = rightToes;
|
|
||||||
foundUnmappedToes = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Transform FindUnmappedToe(Transform foot)
|
|
||||||
{
|
|
||||||
foreach (Transform bone in foot)
|
|
||||||
{
|
|
||||||
if (bone.name.ToLowerInvariant().Contains("toe") ||
|
|
||||||
bone.name.ToLowerInvariant().EndsWith("_end"))
|
|
||||||
{
|
|
||||||
return bone;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void FixFingerBonesError(VRIK vrik)
|
private static void FixFingerBonesError(VRIK vrik)
|
||||||
{
|
{
|
||||||
FixFingerBones(vrik, vrik.references.leftHand, vrik.solver.leftArm);
|
FixFingerBones(vrik, vrik.references.leftHand, vrik.solver.leftArm);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue