From 6c0170e4cf1f4805e445229455a03b449114de8d Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 29 Mar 2023 14:51:36 +0200 Subject: [PATCH 01/15] Update accessibility --- Runtime/HumanoidControl/Scripts/HumanoidControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/HumanoidControl/Scripts/HumanoidControl.cs b/Runtime/HumanoidControl/Scripts/HumanoidControl.cs index 1cb6d07..ef3eddc 100644 --- a/Runtime/HumanoidControl/Scripts/HumanoidControl.cs +++ b/Runtime/HumanoidControl/Scripts/HumanoidControl.cs @@ -470,7 +470,7 @@ namespace Passer.Humanoid { OnChangeAvatarEvent?.Invoke(); } - public void InitializeAvatar() { + public virtual void InitializeAvatar() { avatarRig = GetAvatar(this.gameObject); // Move the animator controller to the targets rig for proper animation support From 3f3f7f4d77162a8b821518fc848d57f130c028cf Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Thu, 30 Mar 2023 13:06:50 +0200 Subject: [PATCH 02/15] Update accessibility --- .../Scripts/HumanoidControl.cs | 2 +- .../Scripts/Physics/HandSocket.cs | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Runtime/HumanoidControl/Scripts/HumanoidControl.cs b/Runtime/HumanoidControl/Scripts/HumanoidControl.cs index ef3eddc..bb17943 100644 --- a/Runtime/HumanoidControl/Scripts/HumanoidControl.cs +++ b/Runtime/HumanoidControl/Scripts/HumanoidControl.cs @@ -2085,7 +2085,7 @@ namespace Passer.Humanoid { hitNormal = Vector3.zero; } - public bool IsMyRigidbody(Rigidbody rigidbody) { + public virtual bool IsMyRigidbody(Rigidbody rigidbody) { return rigidbody != null && ( rigidbody == humanoidRigidbody || diff --git a/Runtime/HumanoidControl/Scripts/Physics/HandSocket.cs b/Runtime/HumanoidControl/Scripts/Physics/HandSocket.cs index a99b380..7993853 100644 --- a/Runtime/HumanoidControl/Scripts/Physics/HandSocket.cs +++ b/Runtime/HumanoidControl/Scripts/Physics/HandSocket.cs @@ -13,17 +13,17 @@ namespace Passer.Humanoid { /// This is the HandTarget of the hand to which the socket is attached public HandTarget handTarget; - protected override void MoveHandleToSocket(Transform socketTransform, Handle handle) { - DebugLog("MoveHandleToHand"); + //protected override void MoveHandleToSocket(Transform socketTransform, Handle handle) { + // DebugLog("MoveHandleToHand"); - Transform handleTransform = handle.GetComponent(); - Rigidbody handleRigidbody = handle.GetComponentInParent(); - if (handleRigidbody != null) - handleTransform = handleRigidbody.transform; + // Transform handleTransform = handle.GetComponent(); + // Rigidbody handleRigidbody = handle.GetComponentInParent(); + // if (handleRigidbody != null) + // handleTransform = handleRigidbody.transform; - handleTransform.rotation = handle.RotationTo(socketTransform.rotation) * handleTransform.rotation; - handleTransform.position += handle.TranslationTo(socketTransform.position); - } + // handleTransform.rotation = handle.RotationTo(socketTransform.rotation) * handleTransform.rotation; + // handleTransform.position += handle.TranslationTo(socketTransform.position); + //} protected override void MoveSocketToHandle(Transform socketTransform, Handle handle) { DebugLog("MoveHandToHandle"); @@ -155,7 +155,7 @@ namespace Passer.Humanoid { DestroyedJoints destroyedJoints = objRigidbody.GetComponent(); // Check if we are grabbing a hand - BasicHandPhysics handPhysics = objRigidbody.GetComponent(); + BasicHandPhysics handPhysics = objRigidbody.GetComponentInParent(); if (handPhysics != null) { // We are grabbing a hand if (thisRigidbody == null) { DebugLog("Cannot attach to hand because this handRigidbody is not present"); From 816bad12c2cf72a13fe4e693851b2af6a791a449 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Thu, 30 Mar 2023 13:09:23 +0200 Subject: [PATCH 03/15] Update accessibility --- Runtime/HumanoidControl/Scripts/Interaction/HandInteraction.cs | 2 +- Runtime/HumanoidControl/Scripts/Targets/HandTarget.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Runtime/HumanoidControl/Scripts/Interaction/HandInteraction.cs b/Runtime/HumanoidControl/Scripts/Interaction/HandInteraction.cs index 3ff62ed..651a150 100644 --- a/Runtime/HumanoidControl/Scripts/Interaction/HandInteraction.cs +++ b/Runtime/HumanoidControl/Scripts/Interaction/HandInteraction.cs @@ -114,7 +114,7 @@ namespace Passer.Humanoid { } } - private void DeterminePalmPosition() { + protected void DeterminePalmPosition() { if (hand.bone.transform == null) return; diff --git a/Runtime/HumanoidControl/Scripts/Targets/HandTarget.cs b/Runtime/HumanoidControl/Scripts/Targets/HandTarget.cs index 69988ab..c74a3f6 100644 --- a/Runtime/HumanoidControl/Scripts/Targets/HandTarget.cs +++ b/Runtime/HumanoidControl/Scripts/Targets/HandTarget.cs @@ -650,7 +650,7 @@ namespace Passer.Humanoid { #endregion - private void InitSubTargets() { + protected void InitSubTargets() { //foreach (TargetedBone subTarget in subTargets) // subTarget.Init(); shoulder.Init(); From 71075deb47512a2b0080de6af0a5a842282ffb59 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 5 Apr 2023 12:32:36 +0200 Subject: [PATCH 04/15] Update accessibility --- Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs b/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs index 06acd71..446d856 100644 --- a/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs +++ b/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs @@ -237,7 +237,7 @@ namespace Passer.Humanoid { return damper; } - protected void ApplyForce(Vector3 force) { + protected virtual void ApplyForce(Vector3 force) { if (float.IsNaN(force.magnitude)) return; @@ -266,7 +266,7 @@ namespace Passer.Humanoid { #endif } - protected void ApplyForceAtPosition(Vector3 force, Vector3 position) { + protected virtual void ApplyForceAtPosition(Vector3 force, Vector3 position) { if (float.IsNaN(force.magnitude)) return; From f19acc51335ba67f276912d8a8e586be22b1877d Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 5 Apr 2023 12:44:15 +0200 Subject: [PATCH 05/15] Update accessibility --- Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs b/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs index 446d856..a54f5c0 100644 --- a/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs +++ b/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs @@ -677,7 +677,7 @@ namespace Passer.Humanoid { handTarget.grabbedObject.SendMessage("OnCollisionEnter", collision, SendMessageOptions.DontRequireReceiver); } - public void OnCollisionStay(Collision collision) { + public virtual void OnCollisionStay(Collision collision) { if (collision.rigidbody != null && collision.rigidbody.gameObject == handTarget.grabbedObject) // Don't collide with the things you are holding return; From c013cf072261e2bc1e3df8ba4a8fcfc30157b584 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 5 Apr 2023 12:50:35 +0200 Subject: [PATCH 06/15] Update accessibility --- Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs b/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs index a54f5c0..6a52b64 100644 --- a/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs +++ b/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs @@ -186,7 +186,7 @@ namespace Passer.Humanoid { #region Force - protected Vector3 CalculateForce() { + protected virtual Vector3 CalculateForce() { /* //Vector3 locationDifference = handTarget.stretchlessTarget.position - handTarget.handRigidbody.position; //Debug.DrawLine(handTarget.stretchlessTarget.position, handTarget.handRigidbody.position); @@ -204,7 +204,7 @@ namespace Passer.Humanoid { return force; } - public Vector3 CalculateForce(Vector3 position, Vector3 targetPosition, bool damping = false) { + public virtual Vector3 CalculateForce(Vector3 position, Vector3 targetPosition, bool damping = false) { Vector3 force = (targetPosition - position) * handTarget.strength; if (damping) force += CalculateForceDamper(); @@ -212,9 +212,9 @@ namespace Passer.Humanoid { } private const float damping = 12; - private float lastDistanceTime; - private Vector3 lastDistanceToTarget; - private Vector3 CalculateForceDamper() { + protected float lastDistanceTime; + protected Vector3 lastDistanceToTarget; + protected virtual Vector3 CalculateForceDamper() { Vector3 distanceToTarget = handTarget.hand.bone.transform.position - handTarget.hand.target.transform.position; float deltaTime = Time.fixedTime - lastDistanceTime; From 34c45dc39a43759ab00168e6824133a3333ecae3 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 5 Apr 2023 12:52:27 +0200 Subject: [PATCH 07/15] Update accessibility --- Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs b/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs index 6a52b64..a809792 100644 --- a/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs +++ b/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs @@ -280,7 +280,7 @@ namespace Passer.Humanoid { #region Torque - protected Vector3 CalculateTorque() { + protected virtual Vector3 CalculateTorque() { Quaternion sollRotation = handTarget.hand.target.transform.rotation * handTarget.hand.target.toBoneRotation; Quaternion istRotation = handTarget.hand.bone.transform.rotation; Quaternion dRot = sollRotation * Quaternion.Inverse(istRotation); @@ -295,7 +295,7 @@ namespace Passer.Humanoid { return torque; } - protected Vector3 CalculateWristTorque() { + protected virtual Vector3 CalculateWristTorque() { //Vector3 wristTension = target.GetWristTension(); // Not stable @@ -311,7 +311,7 @@ namespace Passer.Humanoid { ApplyTorqueAtPosition(torque, handTarget.hand.bone.transform.position); } - protected void ApplyTorqueAtPosition(Vector3 torque, Vector3 posToApply) { + protected virtual void ApplyTorqueAtPosition(Vector3 torque, Vector3 posToApply) { if (float.IsNaN(torque.magnitude)) return; From 178d2427625f40f285d9c50afdac2134869e6137 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 12 Apr 2023 12:06:39 +0200 Subject: [PATCH 08/15] Update accessibility --- Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs b/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs index a809792..9194e02 100644 --- a/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs +++ b/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs @@ -23,7 +23,7 @@ namespace Passer.Humanoid { } [HideInInspector] - protected Rigidbody handRigidbody; + public Rigidbody handRigidbody; protected virtual void Initialize() { if (handTarget == null) From 3d340c43124d4b4e015af60f0eda0183bc4ffc86 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Fri, 14 Apr 2023 10:32:03 +0200 Subject: [PATCH 09/15] Add check for disappeared colliders --- Runtime/Tools/Physics/HybridPhysics.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Runtime/Tools/Physics/HybridPhysics.cs b/Runtime/Tools/Physics/HybridPhysics.cs index 805b1c6..951b60c 100644 --- a/Runtime/Tools/Physics/HybridPhysics.cs +++ b/Runtime/Tools/Physics/HybridPhysics.cs @@ -90,7 +90,7 @@ namespace Passer { } virtual protected void UpdateKinematicRigidbody() { - if (mode == PhysicsMode.NonKinematic || + if (mode == PhysicsMode.NonKinematic || thisRigidbody.mass > kinematicMass || thisRigidbody.GetComponent() != null ) { @@ -183,7 +183,7 @@ namespace Passer { // The sweeptests fail quite often... //RaycastHit hit; //if (!thisRigidbody.SweepTest(target.transform.position - thisRigidbody.position, out hit)) - hasCollided = false; + hasCollided = false; } } @@ -581,8 +581,10 @@ namespace Passer { if (colliders == null) return; - foreach (Collider c in colliders) - c.isTrigger = false; + foreach (Collider c in colliders) { + if (c != null) + c.isTrigger = false; + } } /// @@ -597,8 +599,10 @@ namespace Passer { if (colliders == null) return; - foreach (Collider c in colliders) - c.isTrigger = false; + foreach (Collider c in colliders) { + if (c != null) + c.isTrigger = false; + } } #endregion From 31583b828a0e30941abd7f73049c6caab71026cd Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Fri, 14 Apr 2023 11:06:04 +0200 Subject: [PATCH 10/15] Enable Multi-edit --- Editor/Tools/Handle_Editor.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Editor/Tools/Handle_Editor.cs b/Editor/Tools/Handle_Editor.cs index ca16355..c1d2346 100644 --- a/Editor/Tools/Handle_Editor.cs +++ b/Editor/Tools/Handle_Editor.cs @@ -4,6 +4,7 @@ using UnityEngine; namespace Passer { using Humanoid; + [CanEditMultipleObjects] [CustomEditor(typeof(Handle), true)] public class Handle_Editor : Editor { From e3ea1ce371efa28adce686ffa379729ec56a958f Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Fri, 14 Apr 2023 12:03:13 +0200 Subject: [PATCH 11/15] Fix parameter persistence --- Editor/Tools/Handle_Editor.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Editor/Tools/Handle_Editor.cs b/Editor/Tools/Handle_Editor.cs index c1d2346..6c545a7 100644 --- a/Editor/Tools/Handle_Editor.cs +++ b/Editor/Tools/Handle_Editor.cs @@ -43,9 +43,14 @@ namespace Passer { //if (HumanoidPreferences.help) // EditorGUILayout.HelpBox("Component to specify behaviour when grabbing the GameObject", MessageType.None); - handle.hand = (Handle.Hand)EditorGUILayout.EnumPopup("Hand", handle.hand); - handle.grabType = (Handle.GrabType)EditorGUILayout.EnumPopup("Grab type", handle.grabType); - handle.range = EditorGUILayout.FloatField("Range", handle.range); + SerializedProperty handProp = serializedObject.FindProperty(nameof(Handle.hand)); + handProp.intValue = (int)(Handle.Hand)EditorGUILayout.EnumPopup("Hand", (Handle.Hand)handProp.intValue); + + SerializedProperty grabTypeProp = serializedObject.FindProperty(nameof(Handle.grabType)); + grabTypeProp.intValue = (int)(Handle.GrabType)EditorGUILayout.EnumPopup("Grab type", (Handle.GrabType)grabTypeProp.intValue); + + SerializedProperty rangeProp = serializedObject.FindProperty(nameof(Handle.range)); + rangeProp.floatValue = EditorGUILayout.FloatField("Range", rangeProp.floatValue); HandPoseInspector(handle); CheckHandTarget(handle); From 927dfff7d18651a5414713a6d6794aeadd0b47a7 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Tue, 18 Apr 2023 11:49:12 +0200 Subject: [PATCH 12/15] Fix ShowRealObjectsSwitch persistency --- Editor/HumanoidControl/Targets/HandTarget_Editor.cs | 6 ++---- Runtime/HumanoidControl/Scripts/Targets/Target.cs | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Editor/HumanoidControl/Targets/HandTarget_Editor.cs b/Editor/HumanoidControl/Targets/HandTarget_Editor.cs index 8a37d7c..045fdc9 100644 --- a/Editor/HumanoidControl/Targets/HandTarget_Editor.cs +++ b/Editor/HumanoidControl/Targets/HandTarget_Editor.cs @@ -145,8 +145,6 @@ namespace Passer.Humanoid { InteractionPointerButton(handTarget); serializedObject.ApplyModifiedProperties(); - //serializedObject.Update(); - //serializedObject.ApplyModifiedProperties(); } public static HandTarget Inspector(HandTarget handTarget, string name) { @@ -439,8 +437,8 @@ namespace Passer.Humanoid { if (showSettings) { EditorGUI.indentLevel++; - // Cannot use serializedPropery because showRealObjects is a getter/setter - bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", handTarget.showRealObjects); + SerializedProperty showObjectsProp = serializedObject.FindProperty("_showRealObjects"); + bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", showObjectsProp.boolValue); if (showRealObjects != handTarget.showRealObjects) { handTarget.showRealObjects = showRealObjects; handTarget.ShowSensors(showRealObjects, true); diff --git a/Runtime/HumanoidControl/Scripts/Targets/Target.cs b/Runtime/HumanoidControl/Scripts/Targets/Target.cs index fe2b0ca..752c9a4 100644 --- a/Runtime/HumanoidControl/Scripts/Targets/Target.cs +++ b/Runtime/HumanoidControl/Scripts/Targets/Target.cs @@ -17,6 +17,7 @@ namespace Passer { /// public abstract class Target : MonoBehaviour { + [SerializeField] protected bool _showRealObjects = true; /// /// show the target meshes From e33f599371852977bc267f535fe14062693bb704 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Thu, 20 Apr 2023 16:00:14 +0200 Subject: [PATCH 13/15] Fix controller orientation when using OpenXR --- .../Extensions/UnityXR/UnityXRController.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Runtime/HumanoidControl/Scripts/Extensions/UnityXR/UnityXRController.cs b/Runtime/HumanoidControl/Scripts/Extensions/UnityXR/UnityXRController.cs index cd54ada..a042e37 100644 --- a/Runtime/HumanoidControl/Scripts/Extensions/UnityXR/UnityXRController.cs +++ b/Runtime/HumanoidControl/Scripts/Extensions/UnityXR/UnityXRController.cs @@ -11,6 +11,12 @@ namespace Passer.Tracking { protected XRNode xrNode; + protected enum LoadedDeviceType { + None, + Oculus, + OpenXR, + } + protected LoadedDeviceType loadedDevice = LoadedDeviceType.None; public GameObject model; #region Manage @@ -130,6 +136,12 @@ namespace Passer.Tracking { InputDevices.deviceConnected += OnDeviceConnected; InputDevices.deviceDisconnected += OnDeviceDisconnected; + + if (XRSettings.loadedDeviceName == "oculus display") + loadedDevice = LoadedDeviceType.Oculus; + else if (XRSettings.loadedDeviceName == "OpenXR Display") + loadedDevice = LoadedDeviceType.OpenXR; + } /// @@ -188,6 +200,8 @@ namespace Passer.Tracking { Quaternion rotation; if (isTracked && device.TryGetFeatureValue(CommonUsages.deviceRotation, out rotation)) { + if (loadedDevice == LoadedDeviceType.OpenXR) + rotation *= Quaternion.AngleAxis(45, Vector3.right); transform.rotation = trackerTransform.rotation * rotation; rotationConfidence = 1; status = Tracker.Status.Tracking; From 5d2459979c9f06df41cbca265bb6b053d01fef0d Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Fri, 21 Apr 2023 10:09:42 +0200 Subject: [PATCH 14/15] Fix sticking objects when using collider duplication --- .../HumanoidControl/Scripts/Interaction/HandInteraction.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Runtime/HumanoidControl/Scripts/Interaction/HandInteraction.cs b/Runtime/HumanoidControl/Scripts/Interaction/HandInteraction.cs index 651a150..cb42708 100644 --- a/Runtime/HumanoidControl/Scripts/Interaction/HandInteraction.cs +++ b/Runtime/HumanoidControl/Scripts/Interaction/HandInteraction.cs @@ -658,13 +658,16 @@ namespace Passer.Humanoid { return false; } + // We need to determine this here because the kinematic state + // can change when grabbing + grabbedKinematicRigidbody = objRigidbody.isKinematic; + if (objRigidbody.isKinematic) GrabStaticWithoutHandle(objRigidbody.gameObject); else GrabRigidbodyParenting(objRigidbody); grabbedRigidbody = true; - grabbedKinematicRigidbody = objRigidbody.isKinematic; return true; } From bc6d236e1a7b01c170230329bdb6b9eaff7bd103 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 3 May 2023 14:03:26 +0200 Subject: [PATCH 15/15] Pose fixes --- Runtime/HumanoidControl/Scripts/Pose/BonePose.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Runtime/HumanoidControl/Scripts/Pose/BonePose.cs b/Runtime/HumanoidControl/Scripts/Pose/BonePose.cs index 57cef19..9ac0f47 100644 --- a/Runtime/HumanoidControl/Scripts/Pose/BonePose.cs +++ b/Runtime/HumanoidControl/Scripts/Pose/BonePose.cs @@ -40,17 +40,18 @@ namespace Passer.Humanoid { HumanoidTarget.TargetedBone referenceBone = humanoid.GetBone(referenceBoneRef.boneId); if (referenceBoneRef.boneId != Bone.None && referenceBone.target.transform != null) { referencePosition = referenceBone.target.transform.position; - referenceRotation = referenceBone.bone.targetRotation; + referenceRotation = referenceBone.target.transform.rotation; //referenceBone.bone.targetRotation; referenceScale = referenceBone.target.transform.lossyScale; } else { - referencePosition = humanoid.transform.position; + referencePosition = targetedBone.TargetBasePosition(); // humanoid.transform.position; referenceRotation = humanoid.transform.rotation; referenceScale = humanoid.transform.lossyScale; } if (setTranslation) - targetedBone.target.transform.position = targetedBone.TargetBasePosition() + Vector3.Lerp(Vector3.zero, referenceRotation * translation, value); + //targetedBone.target.transform.position = targetedBone.TargetBasePosition() + Vector3.Lerp(Vector3.zero, referenceRotation * translation, value); + targetedBone.target.transform.position = referencePosition + Vector3.Lerp(Vector3.zero, referenceRotation * translation, value); if (setRotation) targetedBone.target.transform.rotation = Quaternion.Slerp(targetedBone.TargetBaseRotation(), referenceRotation * rotation, value); if (setScale)