quickly add custom IKPose animation support

This commit is contained in:
NotAKidoS 2023-01-14 01:30:29 -06:00
parent 6433dd7c78
commit 06dc5cec08
3 changed files with 23 additions and 24 deletions

View file

@ -1,6 +1,6 @@
using System.Runtime.CompilerServices; using BTKUILib;
using BTKUILib;
using BTKUILib.UIObjects; using BTKUILib.UIObjects;
using System.Runtime.CompilerServices;
namespace NAK.Melons.DesktopVRIK.BTKUI_Integration; namespace NAK.Melons.DesktopVRIK.BTKUI_Integration;

View file

@ -31,7 +31,7 @@ public class DesktopVRIK : MonoBehaviour
// create the shared Head IK Target // create the shared Head IK Target
headIKTarget = new GameObject("[DesktopVRIK] Head IK Target").transform; headIKTarget = new GameObject("[DesktopVRIK] Head IK Target").transform;
headIKTarget.parent = PlayerSetup.Instance.transform; headIKTarget.parent = PlayerSetup.Instance.transform;
headIKTarget.localPosition = new Vector3(0f,1.8f,0f); headIKTarget.localPosition = new Vector3(0f, 1.8f, 0f);
headIKTarget.localRotation = Quaternion.identity; headIKTarget.localRotation = Quaternion.identity;
} }
@ -88,18 +88,17 @@ public class DesktopVRIK : MonoBehaviour
//avatar.transform.rotation = Quaternion.identity; //avatar.transform.rotation = Quaternion.identity;
//ikpose layer (specified by avatar author) //ikpose layer (specified by avatar author)
//int? ikposeLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("IKPose"); int ikposeLayerIndex = animator.GetLayerIndex("IKPose");
//int? locoLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("Locomotion/Emotes"); int locoLayerIndex = animator.GetLayerIndex("Locomotion/Emotes");
if (ikposeLayerIndex != -1)
//if (ikposeLayerIndex != -1) {
//{ animator.SetLayerWeight(ikposeLayerIndex, 1f);
// PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 1f); if (locoLayerIndex != -1)
// if (locoLayerIndex != -1) {
// { animator.SetLayerWeight(locoLayerIndex, 0f);
// PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 0f); }
// } animator.Update(0f);
// IKSystem.Instance.animator.Update(0f); }
//}
//Generic VRIK calibration shit //Generic VRIK calibration shit
VRIK vrik = avatar.gameObject.AddComponent<VRIK>(); VRIK vrik = avatar.gameObject.AddComponent<VRIK>();
@ -149,14 +148,14 @@ public class DesktopVRIK : MonoBehaviour
vrik.solver.SetToReferences(vrik.references); vrik.solver.SetToReferences(vrik.references);
vrik.solver.Initiate(vrik.transform); vrik.solver.Initiate(vrik.transform);
//if (ikposeLayerIndex != -1) if (ikposeLayerIndex != -1)
//{ {
// PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 0f); animator.SetLayerWeight(ikposeLayerIndex, 0f);
// if (locoLayerIndex != -1) if (locoLayerIndex != -1)
// { {
// PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 1f); animator.SetLayerWeight(locoLayerIndex, 1f);
// } }
//} }
//Find eyeoffset //Find eyeoffset
initialCamPos = PlayerSetup.Instance.desktopCamera.transform.localPosition; initialCamPos = PlayerSetup.Instance.desktopCamera.transform.localPosition;