mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
quick cleanin
This commit is contained in:
parent
e6f10f1d79
commit
997d1d8d41
4 changed files with 32 additions and 96 deletions
|
@ -52,96 +52,6 @@ public class DesktopVRIK : MonoBehaviour
|
|||
PlayerSetup.Instance.desktopCamera.transform.localPosition = initialCamPos;
|
||||
}
|
||||
|
||||
public void OnPreSolverUpdate()
|
||||
{
|
||||
//this order matters, rotation offset will be choppy if avatar is not cenetered first
|
||||
//Reset avatar offset (VRIK will literally make you walk away from root otherwise)
|
||||
IKSystem.vrik.transform.localPosition = Vector3.zero;
|
||||
IKSystem.vrik.transform.localRotation = Quaternion.identity;
|
||||
//VRChat hip movement emulation
|
||||
if (Setting_EmulateVRChatHipMovementWeight != 0)
|
||||
{
|
||||
float angle = PlayerSetup.Instance.desktopCamera.transform.localEulerAngles.x;
|
||||
if (angle > 180) angle -= 360;
|
||||
float leanAmount = angle * (1 - MovementSystem.Instance.movementVector.magnitude) * Setting_EmulateVRChatHipMovementWeight;
|
||||
Quaternion rotation = Quaternion.AngleAxis(leanAmount, IKSystem.Instance.avatar.transform.right);
|
||||
IKSystem.vrik.solver.AddRotationOffset(IKSolverVR.RotationOffset.Head, rotation);
|
||||
}
|
||||
IKSystem.vrik.solver.plantFeet = true;
|
||||
}
|
||||
|
||||
public void CalibrateDesktopVRIK(CVRAvatar avatar)
|
||||
{
|
||||
//ikpose layer (specified by avatar author)
|
||||
int? ikposeLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("IKPose");
|
||||
int? locoLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("Locomotion/Emotes");
|
||||
|
||||
if (ikposeLayerIndex != -1)
|
||||
{
|
||||
PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 1f);
|
||||
if (locoLayerIndex != -1)
|
||||
{
|
||||
PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 0f);
|
||||
}
|
||||
IKSystem.Instance.animator.Update(0f);
|
||||
}
|
||||
|
||||
|
||||
//Stuff to make bad armatures work (Fuck you Default Robot Kyle)
|
||||
avatar.transform.localPosition = Vector3.zero;
|
||||
Quaternion originalRotation = avatar.transform.rotation;
|
||||
avatar.transform.rotation = Quaternion.identity;
|
||||
|
||||
//Generic VRIK calibration shit
|
||||
|
||||
IKSystem.vrik.fixTransforms = false;
|
||||
IKSystem.vrik.solver.plantFeet = false;
|
||||
IKSystem.vrik.solver.locomotion.weight = 1f;
|
||||
IKSystem.vrik.solver.locomotion.angleThreshold = 30f;
|
||||
IKSystem.vrik.solver.locomotion.maxLegStretch = 0.75f;
|
||||
//nuke weights
|
||||
IKSystem.vrik.AutoDetectReferences();
|
||||
IKSystem.vrik.solver.spine.headClampWeight = 0f;
|
||||
IKSystem.vrik.solver.spine.minHeadHeight = 0f;
|
||||
IKSystem.vrik.solver.leftArm.positionWeight = 0f;
|
||||
IKSystem.vrik.solver.leftArm.rotationWeight = 0f;
|
||||
IKSystem.vrik.solver.rightArm.positionWeight = 0f;
|
||||
IKSystem.vrik.solver.rightArm.rotationWeight = 0f;
|
||||
IKSystem.vrik.solver.leftLeg.positionWeight = 0f;
|
||||
IKSystem.vrik.solver.leftLeg.rotationWeight = 0f;
|
||||
IKSystem.vrik.solver.rightLeg.positionWeight = 0f;
|
||||
IKSystem.vrik.solver.rightLeg.rotationWeight = 0f;
|
||||
|
||||
//ChilloutVR specific stuff
|
||||
|
||||
|
||||
|
||||
IKSystem.vrik.enabled = false;
|
||||
|
||||
//Calibrate HeadIKOffset *(this is fucked on some avatars, (Fuck you Default Robot Kyle) but setting headAnchorRotationOffset to head rotation fixes (Fuck you Default Robot Kyle))*
|
||||
|
||||
IKSystem.vrik.enabled = true;
|
||||
IKSystem.vrik.solver.IKPositionWeight = 1f;
|
||||
IKSystem.vrik.solver.spine.maintainPelvisPosition = 0f;
|
||||
if (IKSystem.vrik != null)
|
||||
{
|
||||
IKSystem.vrik.onPreSolverUpdate.AddListener(new UnityAction(this.OnPreSolverUpdate));
|
||||
}
|
||||
|
||||
if (ikposeLayerIndex != -1)
|
||||
{
|
||||
PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 0f);
|
||||
if (locoLayerIndex != -1)
|
||||
{
|
||||
PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 1f);
|
||||
}
|
||||
}
|
||||
|
||||
avatar.transform.rotation = originalRotation;
|
||||
IKSystem.Instance.ResetIK();
|
||||
IKSystem.Instance.animator.enabled = true;
|
||||
}
|
||||
|
||||
public void AlternativeOnPreSolverUpdate()
|
||||
{
|
||||
//this order matters, rotation offset will be choppy if avatar is not cenetered first
|
||||
|
@ -185,6 +95,20 @@ public class DesktopVRIK : MonoBehaviour
|
|||
//originalRotation = avatar.transform.rotation;
|
||||
//avatar.transform.rotation = Quaternion.identity;
|
||||
|
||||
//ikpose layer (specified by avatar author)
|
||||
int? ikposeLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("IKPose");
|
||||
int? locoLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("Locomotion/Emotes");
|
||||
|
||||
if (ikposeLayerIndex != -1)
|
||||
{
|
||||
PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 1f);
|
||||
if (locoLayerIndex != -1)
|
||||
{
|
||||
PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 0f);
|
||||
}
|
||||
IKSystem.Instance.animator.Update(0f);
|
||||
}
|
||||
|
||||
//Generic VRIK calibration shit
|
||||
VRIK vrik = avatar.gameObject.AddComponent<VRIK>();
|
||||
vrik.AutoDetectReferences();
|
||||
|
@ -197,7 +121,7 @@ public class DesktopVRIK : MonoBehaviour
|
|||
//nuke weights
|
||||
vrik.solver.spine.headClampWeight = 0f;
|
||||
vrik.solver.spine.minHeadHeight = 0f;
|
||||
vrik.solver.spine.pelvisPositionWeight = 0f;
|
||||
//vrik.solver.spine.pelvisPositionWeight = 0f;
|
||||
vrik.solver.leftArm.positionWeight = 0f;
|
||||
vrik.solver.leftArm.rotationWeight = 0f;
|
||||
vrik.solver.rightArm.positionWeight = 0f;
|
||||
|
@ -233,6 +157,15 @@ public class DesktopVRIK : MonoBehaviour
|
|||
vrik.solver.SetToReferences(vrik.references);
|
||||
vrik.solver.Initiate(vrik.transform);
|
||||
|
||||
if (ikposeLayerIndex != -1)
|
||||
{
|
||||
PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 0f);
|
||||
if (locoLayerIndex != -1)
|
||||
{
|
||||
PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 1f);
|
||||
}
|
||||
}
|
||||
|
||||
if (Setting_TestIKPoseController)
|
||||
{
|
||||
animator.enabled = false;
|
||||
|
|
|
@ -11,7 +11,8 @@ public class DesktopVRIKMod : MelonMod
|
|||
internal static MelonPreferences_Entry<bool> m_entryEnabled,
|
||||
m_entryEnforceViewPosition,
|
||||
m_entryEmoteVRIK,
|
||||
m_entryEmoteLookAtIK;
|
||||
m_entryEmoteLookAtIK,
|
||||
m_entryAllowRootSlipping;
|
||||
internal static MelonPreferences_Entry<float> m_entryEmulateVRChatHipMovementWeight;
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
|
@ -21,6 +22,7 @@ public class DesktopVRIKMod : MelonMod
|
|||
m_entryEnforceViewPosition = m_categoryDesktopVRIK.CreateEntry<bool>("Enforce View Position", false, description: "Corrects view position to use VRIK offsets.");
|
||||
m_entryEmoteVRIK = m_categoryDesktopVRIK.CreateEntry<bool>("Disable Emote VRIK", true, description: "Disable VRIK while emoting. Only disable if you are ok with looking dumb.");
|
||||
m_entryEmoteLookAtIK = m_categoryDesktopVRIK.CreateEntry<bool>("Disable Emote LookAtIK", true, description: "Disable LookAtIK while emoting. This setting doesn't really matter, as LookAtIK isn't networked while doing an emote.");
|
||||
m_entryAllowRootSlipping = m_categoryDesktopVRIK.CreateEntry<bool>("Allow Root Slipping", false, description: "Allows avatar root to slip out from under itself, to emulate more wacky VRChat behavior.");
|
||||
|
||||
foreach (var setting in m_categoryDesktopVRIK.Entries)
|
||||
{
|
||||
|
@ -59,6 +61,7 @@ public class DesktopVRIKMod : MelonMod
|
|||
DesktopVRIK.Setting_EmulateVRChatHipMovementWeight = Mathf.Clamp01(m_entryEmulateVRChatHipMovementWeight.Value);
|
||||
DesktopVRIK.Setting_EmoteVRIK = m_entryEmoteVRIK.Value;
|
||||
DesktopVRIK.Setting_EmoteLookAtIK = m_entryEmoteLookAtIK.Value;
|
||||
DesktopVRIK.Setting_AllowRootSlipping = m_entryAllowRootSlipping.Value;
|
||||
DesktopVRIK.Instance.ChangeViewpointHandling(m_entryEnforceViewPosition.Value);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,6 @@ using System.Reflection;
|
|||
namespace DesktopVRIK.Properties;
|
||||
internal static class AssemblyInfoParams
|
||||
{
|
||||
public const string Version = "1.0.5";
|
||||
public const string Version = "2.0.0";
|
||||
public const string Author = "NotAKidoS";
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_id": 117,
|
||||
"name": "DesktopVRIK",
|
||||
"modversion": "1.0.4",
|
||||
"modversion": "2.0.0",
|
||||
"gameversion": "2022r170",
|
||||
"loaderversion": "0.5.7",
|
||||
"modtype": "Mod",
|
||||
|
@ -16,8 +16,8 @@
|
|||
"requirements": [
|
||||
"None"
|
||||
],
|
||||
"downloadlink": "https://github.com/NotAKidOnSteam/DesktopVRIK/releases/download/v1.0.3/DesktopVRIK.dll",
|
||||
"downloadlink": "https://github.com/NotAKidOnSteam/DesktopVRIK/releases/download/v2.0.0/DesktopVRIK.dll",
|
||||
"sourcelink": "https://github.com/NotAKidOnSteam/DesktopVRIK/",
|
||||
"changelog": "- Simplified VRIK calibration to avoid low heel issue.\n- Removed rushed compatibility mode.\n- Added checks for valid Humanoid rigs.\n- Added PlantFeet & EnforceViewPosition Settings.\n- Added Weight option for the VRChat-like hip movement.",
|
||||
"changelog": "- Simplified VRIK calibration to avoid low heel issue.\n- Removed rushed compatibility mode.\n- Added checks for valid Humanoid rigs.\n- Added PlantFeet & EnforceViewPosition Settings.\n- Added Weight option for the VRChat-like hip movement.\n- Simplified config, added BTKUILib support.\n- Reworked calibration to support almost every avatar.\n- Added custom avatar-defined IKPose support.",
|
||||
"embedcolor": "9b59b6"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue