Fix PickupArmMovement

This commit is contained in:
SDraw 2026-06-20 15:58:56 +03:00
parent ee28311d5d
commit 4838b66b6a
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
3 changed files with 9 additions and 18 deletions

View file

@ -32,7 +32,7 @@ namespace ml_pam
VRIK m_vrIK = null; VRIK m_vrIK = null;
Vector4 m_armsLength; // x,y - from upper arm to hand; z,w - from center to upper arm Vector4 m_armsLength; // x,y - from upper arm to hand; z,w - from center to upper arm
Transform m_camera = null; Transform m_cameraPivot = null;
IKInfo m_ikInfo; IKInfo m_ikInfo;
Transform m_root = null; Transform m_root = null;
@ -69,7 +69,7 @@ namespace ml_pam
void Start() void Start()
{ {
m_camera = PlayerSetup.Instance.activeCam.transform; m_cameraPivot = PlayerSetup.Instance.desktopCameraPivot;
m_root = new GameObject("Root").transform; m_root = new GameObject("Root").transform;
m_root.parent = this.transform; m_root.parent = this.transform;
@ -162,11 +162,8 @@ namespace ml_pam
void Update() void Update()
{ {
if((m_root != null) && (m_camera != null)) m_root.position = m_cameraPivot.position;
{ m_root.rotation = m_cameraPivot.rotation;
m_root.position = m_camera.position;
m_root.rotation = m_camera.rotation;
}
if(!ReferenceEquals(m_pickup, null) && (m_pickup == null)) if(!ReferenceEquals(m_pickup, null) && (m_pickup == null))
OnPickupDrop(m_pickup); OnPickupDrop(m_pickup);
@ -245,11 +242,8 @@ namespace ml_pam
void LateUpdate() void LateUpdate()
{ {
if((m_root != null) && (m_camera != null)) m_root.position = m_cameraPivot.position;
{ m_root.rotation = m_cameraPivot.rotation;
m_root.position = m_camera.position;
m_root.rotation = m_camera.rotation;
}
} }
// VRIK updates // VRIK updates
@ -363,8 +357,6 @@ namespace ml_pam
{ {
try try
{ {
m_camera = PlayerSetup.Instance.activeCam.transform;
if(PlayerSetup.Instance.Animator.isHuman) if(PlayerSetup.Instance.Animator.isHuman)
{ {
m_vrIK = PlayerSetup.Instance.Animator.GetComponent<VRIK>(); m_vrIK = PlayerSetup.Instance.Animator.GetComponent<VRIK>();
@ -457,7 +449,7 @@ namespace ml_pam
} }
} }
else else
m_offset = m_pickup.transform.GetMatrix().inverse * Matrix4x4.TRS(p_hit, m_camera.rotation, Vector3.one); m_offset = m_pickup.transform.GetMatrix().inverse * Matrix4x4.TRS(p_hit, m_cameraPivot.rotation, Vector3.one);
if(Settings.Enabled) if(Settings.Enabled)
OnLeadingHandChanged(Settings.LeadingHand); OnLeadingHandChanged(Settings.LeadingHand);
@ -485,7 +477,6 @@ namespace ml_pam
{ {
try try
{ {
m_camera = PlayerSetup.Instance.activeCam.transform;
this.enabled = !Utils.IsInVR(); this.enabled = !Utils.IsInVR();
} }
catch(System.Exception e) catch(System.Exception e)

View file

@ -1,4 +1,4 @@
[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.2.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.2.5", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPriority(1)] [assembly: MelonLoader.MelonPriority(1)]
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]

View file

@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<PackageId>PickupArmMovement</PackageId> <PackageId>PickupArmMovement</PackageId>
<Version>1.2.4</Version> <Version>1.2.5</Version>
<Authors>SDraw</Authors> <Authors>SDraw</Authors>
<Company>SDraw</Company> <Company>SDraw</Company>
<Product>PickupArmMovement</Product> <Product>PickupArmMovement</Product>