mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-03 10:29:22 +00:00
Instance set changes
Additional animator parameters Reworked rigidbodies Update to latest LeapC and LeapCSharp
This commit is contained in:
parent
1f0b518761
commit
075ff67304
38 changed files with 8310 additions and 8646 deletions
|
@ -48,6 +48,9 @@ namespace ml_pam
|
|||
HandState m_leftHandState = HandState.Empty;
|
||||
HandState m_rightHandState = HandState.Empty;
|
||||
|
||||
AvatarBoolParameter m_leftHandParameter = null;
|
||||
AvatarBoolParameter m_rightHandParameter = null;
|
||||
|
||||
// Unity events
|
||||
void Start()
|
||||
{
|
||||
|
@ -239,7 +242,7 @@ namespace ml_pam
|
|||
{
|
||||
m_enabled = p_state;
|
||||
|
||||
if(m_enabled)
|
||||
if(p_state)
|
||||
{
|
||||
if(m_leftHandState != HandState.Empty)
|
||||
SetArmActive(Settings.LeadHand.Left, true);
|
||||
|
@ -335,6 +338,8 @@ namespace ml_pam
|
|||
m_armIKLeft = null;
|
||||
m_armIKRight = null;
|
||||
m_armLength = 0f;
|
||||
m_leftHandParameter = null;
|
||||
m_rightHandParameter = null;
|
||||
}
|
||||
|
||||
void OnAvatarSetup()
|
||||
|
@ -365,6 +370,9 @@ namespace ml_pam
|
|||
SetupArmIK();
|
||||
}
|
||||
|
||||
m_leftHandParameter = new AvatarBoolParameter("LeftHandExtended", PlayerSetup.Instance.animatorManager);
|
||||
m_rightHandParameter = new AvatarBoolParameter("RightHandExtended", PlayerSetup.Instance.animatorManager);
|
||||
|
||||
OnEnabledChanged(m_enabled);
|
||||
}
|
||||
|
||||
|
@ -533,6 +541,11 @@ namespace ml_pam
|
|||
m_armIKRight.solver.IKPositionWeight = (p_state ? 1f : 0f);
|
||||
m_armIKRight.solver.IKRotationWeight = (p_state ? 1f : 0f);
|
||||
}
|
||||
|
||||
if((p_hand == Settings.LeadHand.Left) || (p_hand == Settings.LeadHand.Both))
|
||||
m_leftHandParameter?.SetValue(p_state);
|
||||
if((p_hand == Settings.LeadHand.Right) || (p_hand == Settings.LeadHand.Both))
|
||||
m_rightHandParameter?.SetValue(p_state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
43
ml_pam/AvatarBoolParameter.cs
Normal file
43
ml_pam/AvatarBoolParameter.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using ABI_RC.Core.Util.AnimatorManager;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ml_pam
|
||||
{
|
||||
class AvatarBoolParameter
|
||||
{
|
||||
public readonly string m_name;
|
||||
public readonly int m_hash = 0;
|
||||
public readonly bool m_sync;
|
||||
readonly AvatarAnimatorManager m_manager = null;
|
||||
|
||||
public AvatarBoolParameter(string p_name, AvatarAnimatorManager p_manager)
|
||||
{
|
||||
m_name = p_name;
|
||||
m_manager = p_manager;
|
||||
|
||||
Regex l_regex = new Regex("^#?" + p_name + '$');
|
||||
foreach(var l_param in m_manager.Animator.parameters)
|
||||
{
|
||||
if(l_regex.IsMatch(l_param.name) && (l_param.type == AnimatorControllerParameterType.Bool))
|
||||
{
|
||||
m_name = l_param.name;
|
||||
m_sync = !l_param.name.StartsWith('#');
|
||||
m_hash = l_param.nameHash;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetValue(bool p_value)
|
||||
{
|
||||
if(m_hash != 0)
|
||||
{
|
||||
if(m_sync)
|
||||
m_manager.SetParameter(m_name, p_value);
|
||||
else
|
||||
m_manager.Animator.SetBool(m_hash, p_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.1.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||
[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.1.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||
[assembly: MelonLoader.MelonPriority(1)]
|
||||
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||
|
|
|
@ -13,6 +13,9 @@ Available mod's settings in `Settings - Interactions - Pickup Arm Movement`:
|
|||
* **Leading hand:** hand that will be extended when gragging pickup; available values: `Left`, `Right`, `Both`; default value - `Right`.
|
||||
* **Hands extension (Q\E):** extend left and right hand if `Q` and `E` keys are pressed; default value - `true`.
|
||||
|
||||
Available animator boolean parameters:
|
||||
* **LeftHandExtended:`` indicates if left hand is extended.
|
||||
* **RightHandExtended:`` indicates if right hand is extended.
|
||||
|
||||
# Notes
|
||||
* Made for desktop mode in mind.
|
||||
* Compatible with [DekstopVRIK](https://github.com/NotAKidOnSteam/NAK_CVR_Mods).
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Platforms>x64</Platforms>
|
||||
<PackageId>PickupArmMovement</PackageId>
|
||||
<Version>1.1.3</Version>
|
||||
<Version>1.1.4</Version>
|
||||
<Authors>SDraw</Authors>
|
||||
<Company>None</Company>
|
||||
<Product>PickupArmMovement</Product>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue