mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 23:09:22 +00:00
[AlternateIKSystem] Fix offset issues
This commit is contained in:
parent
9847827813
commit
99c0256ed3
4 changed files with 20 additions and 26 deletions
|
@ -1,6 +1,5 @@
|
||||||
using RootMotion.FinalIK;
|
using RootMotion.FinalIK;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Valve.VR;
|
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
namespace NAK.AlternateIKSystem.IK;
|
namespace NAK.AlternateIKSystem.IK;
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using ABI.CCK.Components;
|
using RootMotion.FinalIK;
|
||||||
using NAK.AlternateIKSystem.VRIKHelpers;
|
|
||||||
using RootMotion.FinalIK;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NAK.AlternateIKSystem.IK.IKHandlers;
|
namespace NAK.AlternateIKSystem.IK.IKHandlers;
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using ABI.CCK.Components;
|
using RootMotion.FinalIK;
|
||||||
using NAK.AlternateIKSystem.VRIKHelpers;
|
|
||||||
using RootMotion.FinalIK;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NAK.AlternateIKSystem.IK.IKHandlers;
|
namespace NAK.AlternateIKSystem.IK.IKHandlers;
|
||||||
|
|
|
@ -6,7 +6,6 @@ using NAK.AlternateIKSystem.VRIKHelpers;
|
||||||
using RootMotion.FinalIK;
|
using RootMotion.FinalIK;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
using Object = System.Object;
|
|
||||||
|
|
||||||
namespace NAK.AlternateIKSystem.IK;
|
namespace NAK.AlternateIKSystem.IK;
|
||||||
|
|
||||||
|
@ -42,9 +41,9 @@ public class IKManager : MonoBehaviour
|
||||||
private Transform _rightHandTarget;
|
private Transform _rightHandTarget;
|
||||||
private Transform _rightHandRotations;
|
private Transform _rightHandRotations;
|
||||||
|
|
||||||
// Hand Anchor Offsets
|
// Hand Anchor Offsets (the magic numbers that make or break the game)
|
||||||
private readonly Vector3 _handAnchorPositionOffset = new Vector3(-0.038f, 0.0389f, -0.138f);
|
private readonly Vector3 _handAnchorPositionOffset = new Vector3(-0.048f, 0.0389f, -0.138f);
|
||||||
private readonly Vector3 _handAnchorRotationOffset = new Vector3(55, 10, 50);
|
private readonly Vector3 _handAnchorRotationOffset = new Vector3(70f, 0f, 50f);
|
||||||
|
|
||||||
// Avatar Info
|
// Avatar Info
|
||||||
private Animator _animator;
|
private Animator _animator;
|
||||||
|
@ -240,10 +239,10 @@ public class IKManager : MonoBehaviour
|
||||||
|
|
||||||
private void SetupIkGeneral()
|
private void SetupIkGeneral()
|
||||||
{
|
{
|
||||||
|
_animator.transform.position = GetPlayerPosition();
|
||||||
|
_animator.transform.rotation = GetPlayerRotation();
|
||||||
SetAvatarPose(AvatarPose.Default);
|
SetAvatarPose(AvatarPose.Default);
|
||||||
_vrik = IKCalibrator.SetupVrIk(_animator);
|
_vrik = IKCalibrator.SetupVrIk(_animator);
|
||||||
_vrik.transform.position = GetPlayerPosition();
|
|
||||||
_vrik.transform.rotation = GetPlayerRotation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeIkGeneral()
|
private void InitializeIkGeneral()
|
||||||
|
@ -252,11 +251,11 @@ public class IKManager : MonoBehaviour
|
||||||
|
|
||||||
VRIKUtils.CalculateInitialIKScaling(_vrik, ref _ikHandler._locomotionData);
|
VRIKUtils.CalculateInitialIKScaling(_vrik, ref _ikHandler._locomotionData);
|
||||||
VRIKUtils.CalculateInitialFootsteps(_vrik, ref _ikHandler._locomotionData);
|
VRIKUtils.CalculateInitialFootsteps(_vrik, ref _ikHandler._locomotionData);
|
||||||
|
|
||||||
_vrik.solver.Initiate(_vrik.transform); // initiate a second time
|
_vrik.solver.Initiate(_vrik.transform); // initiate a second time
|
||||||
|
|
||||||
VRIKUtils.ApplyScaleToVRIK(_vrik, _ikHandler._locomotionData, 1f);
|
SetAvatarPose(AvatarPose.Initial);
|
||||||
|
|
||||||
|
VRIKUtils.ApplyScaleToVRIK(_vrik, _ikHandler._locomotionData, 1f);
|
||||||
_vrik.onPreSolverUpdate.AddListener(new UnityAction(OnPreSolverUpdateGeneral));
|
_vrik.onPreSolverUpdate.AddListener(new UnityAction(OnPreSolverUpdateGeneral));
|
||||||
_vrik.onPostSolverUpdate.AddListener(new UnityAction(OnPostSolverUpdateGeneral));
|
_vrik.onPostSolverUpdate.AddListener(new UnityAction(OnPostSolverUpdateGeneral));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue