diff --git a/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs b/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs index 18e9efd..3c229bc 100644 --- a/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs +++ b/Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs @@ -417,6 +417,8 @@ namespace Passer.Humanoid { float distance = Vector3.Distance(handTarget.hand.bone.transform.position, handTarget.forearm.bone.transform.position) - handTarget.forearm.bone.length; if (distance > 0.05F) { handTarget.colliders = SetKinematic(handRigidbody); + // make sure the hand returns + PlaceHandOnArm(handTarget, handTarget.forearm.bone.targetRotation); } } @@ -425,6 +427,11 @@ namespace Passer.Humanoid { colliding = false; } + protected void PlaceHandOnArm(HandTarget handTarget, Quaternion forearmRotation) { + //Debug.Log("PlaceHandOnArm"); + handTarget.hand.bone.transform.position = handTarget.forearm.bone.transform.position + forearmRotation * -handTarget.outward * handTarget.forearm.bone.length; + } + public virtual void UpdateRigidbody() { if (handRigidbody == null) { UpdateGrabbedMechanicalJoint();