mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-03 10:29:22 +00:00
Minor code changes
This commit is contained in:
parent
19606527fc
commit
11287e7dc5
36 changed files with 329 additions and 273 deletions
|
@ -91,7 +91,7 @@ namespace ml_lme
|
|||
{
|
||||
if(m_fingersBones[i] != null)
|
||||
{
|
||||
//m_fingers[i].position = p_data.m_fingerPosition[i];
|
||||
//m_fingersBones[i].position = p_data.m_fingerPosition[i];
|
||||
m_fingersBones[i].rotation = p_data.m_fingerRotation[i];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Systems.IK;
|
||||
using RootMotion.FinalIK;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -195,22 +194,17 @@ namespace ml_lme
|
|||
}
|
||||
|
||||
m_poseHandler.GetHumanPose(ref m_pose);
|
||||
if(l_data.m_leftHand.m_present)
|
||||
if(l_data.m_leftHand.m_present || l_data.m_rightHand.m_present)
|
||||
{
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
int l_offset = i * 4;
|
||||
|
||||
ms_lastLeftFingerBones[l_offset] = m_pose.muscles[(int)MuscleIndex.LeftThumb1Stretched + l_offset];
|
||||
ms_lastLeftFingerBones[l_offset + 1] = m_pose.muscles[(int)MuscleIndex.LeftThumb2Stretched + l_offset];
|
||||
ms_lastLeftFingerBones[l_offset + 2] = m_pose.muscles[(int)MuscleIndex.LeftThumb3Stretched + l_offset];
|
||||
ms_lastLeftFingerBones[l_offset + 3] = m_pose.muscles[(int)MuscleIndex.LeftThumbSpread + l_offset];
|
||||
}
|
||||
}
|
||||
if(l_data.m_rightHand.m_present)
|
||||
{
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
int l_offset = i * 4;
|
||||
|
||||
ms_lastRightFingerBones[l_offset] = m_pose.muscles[(int)MuscleIndex.RightThumb1Stretched + l_offset];
|
||||
ms_lastRightFingerBones[l_offset + 1] = m_pose.muscles[(int)MuscleIndex.RightThumb2Stretched + l_offset];
|
||||
ms_lastRightFingerBones[l_offset + 2] = m_pose.muscles[(int)MuscleIndex.RightThumb3Stretched + l_offset];
|
||||
|
@ -249,21 +243,14 @@ namespace ml_lme
|
|||
internal void OnAvatarSetup()
|
||||
{
|
||||
m_inVR = Utils.IsInVR();
|
||||
m_vrIK = PlayerSetup.Instance._animator.GetComponent<VRIK>();
|
||||
|
||||
if(PlayerSetup.Instance._animator.isHuman)
|
||||
{
|
||||
Utils.SetAvatarTPose();
|
||||
|
||||
m_poseHandler = new HumanPoseHandler(PlayerSetup.Instance._animator.avatar, PlayerSetup.Instance._animator.transform);
|
||||
m_poseHandler.GetHumanPose(ref m_pose);
|
||||
|
||||
if(m_inVR)
|
||||
{
|
||||
PlayerSetup.Instance._avatar.transform.localPosition = Vector3.zero;
|
||||
PlayerSetup.Instance._avatar.transform.localRotation = Quaternion.identity;
|
||||
}
|
||||
else
|
||||
PoseHelper.ForceTPose(PlayerSetup.Instance._animator);
|
||||
|
||||
m_leftHand = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.LeftHand);
|
||||
m_leftHandTarget.localRotation = ms_offsetLeft * (Quaternion.Inverse(PlayerSetup.Instance._avatar.transform.rotation) * m_leftHand.rotation);
|
||||
|
||||
|
@ -272,6 +259,7 @@ namespace ml_lme
|
|||
|
||||
ParseFingersBones();
|
||||
|
||||
m_vrIK = PlayerSetup.Instance._animator.GetComponent<VRIK>();
|
||||
if(m_vrIK != null)
|
||||
{
|
||||
m_vrIK.onPreSolverUpdate.AddListener(this.OnIKPreUpdate);
|
||||
|
@ -298,7 +286,7 @@ namespace ml_lme
|
|||
}
|
||||
else
|
||||
{
|
||||
PoseHelper.ForceTPose(PlayerSetup.Instance._animator);
|
||||
Utils.SetAvatarTPose();
|
||||
SetupArmIK();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
using UnityEngine;
|
||||
using ABI_RC.Systems.IK;
|
||||
|
||||
namespace ml_lme
|
||||
{
|
||||
static class PoseHelper
|
||||
{
|
||||
public static void ForceTPose(Animator p_animator)
|
||||
{
|
||||
if(p_animator.isHuman)
|
||||
{
|
||||
HumanPoseHandler l_handler = new HumanPoseHandler(p_animator.avatar, p_animator.transform);
|
||||
HumanPose l_pose = new HumanPose();
|
||||
l_handler.GetHumanPose(ref l_pose);
|
||||
|
||||
for(int i=0, j = Mathf.Min(l_pose.muscles.Length,MusclePoses.TPoseMuscles.Length); i < j; i++)
|
||||
l_pose.muscles[i] = MusclePoses.TPoseMuscles[i];
|
||||
|
||||
l_pose.bodyPosition = Vector3.up;
|
||||
l_pose.bodyRotation = Quaternion.identity;
|
||||
l_handler.SetHumanPose(ref l_pose);
|
||||
l_handler.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -56,20 +56,20 @@ namespace ml_lme
|
|||
static MelonLoader.MelonPreferences_Category ms_category = null;
|
||||
static List<MelonLoader.MelonPreferences_Entry> ms_entries = null;
|
||||
|
||||
static public event Action<bool> EnabledChange;
|
||||
static public event Action<Vector3> DesktopOffsetChange;
|
||||
static public event Action<bool> FingersOnlyChange;
|
||||
static public event Action<bool> ModelVisibilityChange;
|
||||
static public event Action<LeapTrackingMode> TrackingModeChange;
|
||||
static public event Action<Vector3> RootAngleChange;
|
||||
static public event Action<bool> HeadAttachChange;
|
||||
static public event Action<Vector3> HeadOffsetChange;
|
||||
static public event Action<bool> TrackElbowsChange;
|
||||
static public event Action<bool> InteractionChange;
|
||||
static public event Action<bool> GesturesChange;
|
||||
static public event Action<float> InteractThreadholdChange;
|
||||
static public event Action<float> GripThreadholdChange;
|
||||
static public event Action<bool> VisualHandsChange;
|
||||
public static event Action<bool> EnabledChange;
|
||||
public static event Action<Vector3> DesktopOffsetChange;
|
||||
public static event Action<bool> FingersOnlyChange;
|
||||
public static event Action<bool> ModelVisibilityChange;
|
||||
public static event Action<LeapTrackingMode> TrackingModeChange;
|
||||
public static event Action<Vector3> RootAngleChange;
|
||||
public static event Action<bool> HeadAttachChange;
|
||||
public static event Action<Vector3> HeadOffsetChange;
|
||||
public static event Action<bool> TrackElbowsChange;
|
||||
public static event Action<bool> InteractionChange;
|
||||
public static event Action<bool> GesturesChange;
|
||||
public static event Action<float> InteractThreadholdChange;
|
||||
public static event Action<float> GripThreadholdChange;
|
||||
public static event Action<bool> VisualHandsChange;
|
||||
|
||||
internal static void Init()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using ABI_RC.Core.InteractionSystem;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Core.UI;
|
||||
using ABI_RC.Systems.IK;
|
||||
using ABI_RC.Systems.InputManagement;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
@ -49,7 +51,14 @@ namespace ml_lme
|
|||
}
|
||||
}
|
||||
|
||||
static public void ExecuteScript(this CohtmlControlledViewWrapper p_instance, string p_script) => ((cohtml.Net.View)ms_view.GetValue(p_instance)).ExecuteScript(p_script);
|
||||
public static void ExecuteScript(this CohtmlControlledViewWrapper p_instance, string p_script) => ((cohtml.Net.View)ms_view.GetValue(p_instance)).ExecuteScript(p_script);
|
||||
|
||||
public static void SetAvatarTPose()
|
||||
{
|
||||
IKSystem.Instance.SetAvatarPose(IKSystem.AvatarPose.TPose);
|
||||
PlayerSetup.Instance._avatar.transform.localPosition = Vector3.zero;
|
||||
PlayerSetup.Instance._avatar.transform.localRotation = Quaternion.identity;
|
||||
}
|
||||
|
||||
public static void Swap<T>(ref T lhs, ref T rhs)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue