mirror of
https://github.com/SDraw/ml_mods_cvr.git
synced 2026-06-20 13:28:29 +00:00
Fixed LeapMotionExtension
This commit is contained in:
parent
92357d3076
commit
ee28311d5d
7 changed files with 40 additions and 10 deletions
|
|
@ -28,6 +28,7 @@ namespace ml_lme
|
|||
public static readonly GameEvent<float> OnRayScale = new GameEvent<float>();
|
||||
public static readonly GameEvent<float> OnPlayspaceScale = new GameEvent<float>();
|
||||
public static readonly GameEvent<CVRPickupObject> OnPickupGrab = new GameEvent<CVRPickupObject>();
|
||||
public static readonly GameEvent<PlayerAvatarMovementData> OnPostLocalPlayerMovementDataUpdate = new GameEvent<PlayerAvatarMovementData>();
|
||||
|
||||
internal static void Init(HarmonyLib.Harmony p_instance)
|
||||
{
|
||||
|
|
@ -56,6 +57,12 @@ namespace ml_lme
|
|||
null,
|
||||
new HarmonyLib.HarmonyMethod(typeof(GameEvents).GetMethod(nameof(OnPickupGrab_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||
);
|
||||
|
||||
p_instance.Patch(
|
||||
typeof(PlayerSetup).GetMethod("UpdatePlayerAvatarMovementData", BindingFlags.Instance | BindingFlags.NonPublic),
|
||||
null,
|
||||
new HarmonyLib.HarmonyMethod(typeof(GameEvents).GetMethod(nameof(OnPlayerAvatarMovementDataUpdate_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||
);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
|
@ -110,5 +117,17 @@ namespace ml_lme
|
|||
MelonLoader.MelonLogger.Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
static void OnPlayerAvatarMovementDataUpdate_Postfix(PlayerAvatarMovementData ____playerAvatarMovementData)
|
||||
{
|
||||
try
|
||||
{
|
||||
OnPostLocalPlayerMovementDataUpdate.Invoke(____playerAvatarMovementData);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MelonLoader.MelonLogger.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using ABI.CCK.Components;
|
|||
using ABI_RC.Core.InteractionSystem;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Systems.IK;
|
||||
using ABI_RC.Systems.InputManagement;
|
||||
using ABI_RC.Systems.VRModeSwitch;
|
||||
using System.Collections;
|
||||
|
|
@ -651,7 +650,6 @@ namespace ml_lme
|
|||
void SetGameFingersTracking(bool p_state)
|
||||
{
|
||||
base._inputManager.individualFingerTracking = p_state;
|
||||
IKSystem.Instance.FingerSystem.ControlActive = base._inputManager.individualFingerTracking;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace ml_lme
|
|||
{
|
||||
if(Instance != null)
|
||||
{
|
||||
DestroyImmediate(this);
|
||||
Destroy(this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ namespace ml_lme
|
|||
CVRGameEventSystem.Avatar.OnLocalAvatarLoad.AddListener(this.OnAvatarSetup);
|
||||
CVRGameEventSystem.Avatar.OnLocalAvatarClear.AddListener(this.OnAvatarClear);
|
||||
GameEvents.OnAvatarReuse.AddListener(this.OnAvatarReuse);
|
||||
GameEvents.OnPostLocalPlayerMovementDataUpdate.AddListener(this.OnMovementDataUpdate);
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
|
|
@ -179,6 +180,7 @@ namespace ml_lme
|
|||
CVRGameEventSystem.Avatar.OnLocalAvatarLoad.RemoveListener(this.OnAvatarSetup);
|
||||
CVRGameEventSystem.Avatar.OnLocalAvatarClear.RemoveListener(this.OnAvatarClear);
|
||||
GameEvents.OnAvatarReuse.RemoveListener(this.OnAvatarReuse);
|
||||
GameEvents.OnPostLocalPlayerMovementDataUpdate.RemoveListener(this.OnMovementDataUpdate);
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
|
@ -326,6 +328,17 @@ namespace ml_lme
|
|||
}
|
||||
}
|
||||
|
||||
void OnMovementDataUpdate(PlayerAvatarMovementData p_data)
|
||||
{
|
||||
if(Settings.Enabled && (m_poseHandler != null))
|
||||
{
|
||||
p_data.UseIndividualFingers = true;
|
||||
|
||||
System.Array.Copy(m_pose.muscles, PlayerAvatarMovementData.MuscleGroups.LeftFingersStart, p_data.MuscleValues, PlayerAvatarMovementData.MuscleGroups.LeftFingersStart, PlayerAvatarMovementData.MuscleGroups.LeftFingersCount);
|
||||
System.Array.Copy(m_pose.muscles, PlayerAvatarMovementData.MuscleGroups.RightFingersStart, p_data.MuscleValues, PlayerAvatarMovementData.MuscleGroups.RightFingersStart, PlayerAvatarMovementData.MuscleGroups.RightFingersCount);
|
||||
}
|
||||
}
|
||||
|
||||
void OnAvatarReuse()
|
||||
{
|
||||
// Old VRIK is destroyed by game
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ml_lme
|
||||
|
|
@ -24,10 +25,9 @@ namespace ml_lme
|
|||
{
|
||||
if(Instance != null)
|
||||
{
|
||||
Object.DestroyImmediate(this);
|
||||
Object.Destroy(this);
|
||||
return;
|
||||
}
|
||||
|
||||
Instance = this;
|
||||
|
||||
m_root = new GameObject("Root").transform;
|
||||
|
|
@ -136,9 +136,9 @@ namespace ml_lme
|
|||
{
|
||||
if(Settings.Enabled)
|
||||
{
|
||||
Transform l_camera = PlayerSetup.Instance.activeCam.transform;
|
||||
m_root.position = l_camera.position;
|
||||
m_root.rotation = (Settings.HeadAttach ? l_camera.rotation : PlayerSetup.Instance.GetPlayerRotation());
|
||||
Transform l_pivot = MetaPort.Instance.isUsingVr ? PlayerSetup.Instance.vrCamera.transform : PlayerSetup.Instance.desktopCameraPivot;
|
||||
m_root.position = l_pivot.position;
|
||||
m_root.rotation = (Settings.HeadAttach ? l_pivot.rotation : PlayerSetup.Instance.GetPlayerRotation());
|
||||
|
||||
LeapParser.LeapData l_data = LeapManager.Instance.GetLatestData();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.6.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||
[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.6.5", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Platforms>x64</Platforms>
|
||||
<PackageId>LeapMotionExtension</PackageId>
|
||||
<Version>1.6.4</Version>
|
||||
<Version>1.6.5</Version>
|
||||
<Authors>SDraw</Authors>
|
||||
<Company>SDraw</Company>
|
||||
<Product>LeapMotionExtension</Product>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue