mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
Added HipMovement Weight & Fixed Emote avatar position
This commit is contained in:
parent
3f7d4335ad
commit
04de34d5d3
4 changed files with 23 additions and 9 deletions
|
@ -13,12 +13,13 @@ public class DesktopVRIK : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static DesktopVRIK Instance;
|
public static DesktopVRIK Instance;
|
||||||
|
|
||||||
public bool Setting_Enabled;
|
public bool Setting_Enabled,
|
||||||
public bool Setting_EmulateVRChatHipMovement;
|
Setting_EmulateVRChatHipMovement,
|
||||||
public bool Setting_EnforceViewPosition;
|
Setting_EnforceViewPosition,
|
||||||
public bool Setting_EmoteVRIK;
|
Setting_EmoteVRIK,
|
||||||
public bool Setting_EmoteLookAtIK;
|
Setting_EmoteLookAtIK,
|
||||||
public bool Setting_PlantFeet;
|
Setting_PlantFeet;
|
||||||
|
public float Setting_EmulateVRChatHipMovementWeight;
|
||||||
|
|
||||||
public Transform viewpoint;
|
public Transform viewpoint;
|
||||||
public Vector3 initialCamPos;
|
public Vector3 initialCamPos;
|
||||||
|
@ -49,7 +50,7 @@ public class DesktopVRIK : MonoBehaviour
|
||||||
{
|
{
|
||||||
float angle = PlayerSetup.Instance.desktopCamera.transform.localEulerAngles.x;
|
float angle = PlayerSetup.Instance.desktopCamera.transform.localEulerAngles.x;
|
||||||
angle = (angle > 180) ? angle - 360 : angle;
|
angle = (angle > 180) ? angle - 360 : angle;
|
||||||
float weight = (1 - MovementSystem.Instance.movementVector.magnitude);
|
float weight = (Setting_EmulateVRChatHipMovementWeight - MovementSystem.Instance.movementVector.magnitude);
|
||||||
Quaternion rotation = Quaternion.AngleAxis(angle * weight, IKSystem.Instance.avatar.transform.right);
|
Quaternion rotation = Quaternion.AngleAxis(angle * weight, IKSystem.Instance.avatar.transform.right);
|
||||||
IKSystem.vrik.solver.AddRotationOffset(IKSolverVR.RotationOffset.Head, rotation);
|
IKSystem.vrik.solver.AddRotationOffset(IKSolverVR.RotationOffset.Head, rotation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,8 @@ internal class HarmonyPatches
|
||||||
{
|
{
|
||||||
___lookIK.enabled = false;
|
___lookIK.enabled = false;
|
||||||
}
|
}
|
||||||
|
IKSystem.vrik.transform.localPosition = Vector3.zero;
|
||||||
|
IKSystem.vrik.transform.localRotation = Quaternion.identity;
|
||||||
}
|
}
|
||||||
else if (!____emotePlaying && emotePlayed)
|
else if (!____emotePlaying && emotePlayed)
|
||||||
{
|
{
|
||||||
|
@ -88,6 +90,8 @@ internal class HarmonyPatches
|
||||||
{
|
{
|
||||||
___lookIK.enabled = true;
|
___lookIK.enabled = true;
|
||||||
}
|
}
|
||||||
|
IKSystem.vrik.transform.localPosition = Vector3.zero;
|
||||||
|
IKSystem.vrik.transform.localRotation = Quaternion.identity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using ABI_RC.Core.Player;
|
using ABI_RC.Core.Player;
|
||||||
using MelonLoader;
|
using MelonLoader;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DesktopVRIK;
|
namespace DesktopVRIK;
|
||||||
|
|
||||||
|
@ -7,12 +8,19 @@ public class DesktopVRIKMod : MelonMod
|
||||||
{
|
{
|
||||||
internal const string SettingsCategory = "DesktopVRIK";
|
internal const string SettingsCategory = "DesktopVRIK";
|
||||||
private static MelonPreferences_Category m_categoryDesktopVRIK;
|
private static MelonPreferences_Category m_categoryDesktopVRIK;
|
||||||
private static MelonPreferences_Entry<bool> m_entryEnabled, m_entryEmulateHipMovement, m_entryEnforceViewPosition, m_entryEmoteVRIK, m_entryEmoteLookAtIK, m_entryPlantFeet;
|
private static MelonPreferences_Entry<bool> m_entryEnabled,
|
||||||
|
m_entryEmulateHipMovement,
|
||||||
|
m_entryEnforceViewPosition,
|
||||||
|
m_entryEmoteVRIK,
|
||||||
|
m_entryEmoteLookAtIK,
|
||||||
|
m_entryPlantFeet;
|
||||||
|
private static MelonPreferences_Entry<float> m_entryEmulateVRChatHipMovementWeight;
|
||||||
public override void OnInitializeMelon()
|
public override void OnInitializeMelon()
|
||||||
{
|
{
|
||||||
m_categoryDesktopVRIK = MelonPreferences.CreateCategory(SettingsCategory);
|
m_categoryDesktopVRIK = MelonPreferences.CreateCategory(SettingsCategory);
|
||||||
m_entryEnabled = m_categoryDesktopVRIK.CreateEntry<bool>("Enabled", true, description: "Attempt to give Desktop VRIK on avatar load.");
|
m_entryEnabled = m_categoryDesktopVRIK.CreateEntry<bool>("Enabled", true, description: "Attempt to give Desktop VRIK on avatar load.");
|
||||||
m_entryEmulateHipMovement = m_categoryDesktopVRIK.CreateEntry<bool>("Emulate Hip Movement", true, description: "Emulates VRChat-like hip movement when moving head up/down on desktop.");
|
m_entryEmulateHipMovement = m_categoryDesktopVRIK.CreateEntry<bool>("Emulate Hip Movement", true, description: "Emulates VRChat-like hip movement when moving head up/down on desktop.");
|
||||||
|
m_entryEmulateVRChatHipMovementWeight = m_categoryDesktopVRIK.CreateEntry<float>("Hip Movement Weight", 1f, description: "The weight modifier for the hip movement.");
|
||||||
m_entryEnforceViewPosition = m_categoryDesktopVRIK.CreateEntry<bool>("Enforce View Position", false, description: "Corrects view position to use VRIK offsets.");
|
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_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_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.");
|
||||||
|
@ -41,6 +49,7 @@ public class DesktopVRIKMod : MelonMod
|
||||||
if (!DesktopVRIK.Instance) return;
|
if (!DesktopVRIK.Instance) return;
|
||||||
DesktopVRIK.Instance.Setting_Enabled = m_entryEnabled.Value;
|
DesktopVRIK.Instance.Setting_Enabled = m_entryEnabled.Value;
|
||||||
DesktopVRIK.Instance.Setting_EmulateVRChatHipMovement = m_entryEmulateHipMovement.Value;
|
DesktopVRIK.Instance.Setting_EmulateVRChatHipMovement = m_entryEmulateHipMovement.Value;
|
||||||
|
DesktopVRIK.Instance.Setting_EmulateVRChatHipMovementWeight = Mathf.Clamp01(m_entryEmulateVRChatHipMovementWeight.Value);
|
||||||
DesktopVRIK.Instance.Setting_EmoteVRIK = m_entryEmoteVRIK.Value;
|
DesktopVRIK.Instance.Setting_EmoteVRIK = m_entryEmoteVRIK.Value;
|
||||||
DesktopVRIK.Instance.Setting_EmoteLookAtIK = m_entryEmoteLookAtIK.Value;
|
DesktopVRIK.Instance.Setting_EmoteLookAtIK = m_entryEmoteLookAtIK.Value;
|
||||||
DesktopVRIK.Instance.Setting_PlantFeet = m_entryPlantFeet.Value;
|
DesktopVRIK.Instance.Setting_PlantFeet = m_entryPlantFeet.Value;
|
||||||
|
|
|
@ -25,6 +25,6 @@ using System.Reflection;
|
||||||
namespace DesktopVRIK.Properties;
|
namespace DesktopVRIK.Properties;
|
||||||
internal static class AssemblyInfoParams
|
internal static class AssemblyInfoParams
|
||||||
{
|
{
|
||||||
public const string Version = "1.0.3";
|
public const string Version = "1.0.4";
|
||||||
public const string Author = "NotAKidoS";
|
public const string Author = "NotAKidoS";
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue