From 1e7dc017623fd2654e1ed85fe9c3c25ed51e44d0 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 24 Sep 2025 10:35:27 +0200 Subject: [PATCH] Fix stretchy arm for hand stuck behind static object --- Runtime/HumanoidControl/Scripts/Physics/HandPhysics.cs | 7 +++++++ 1 file changed, 7 insertions(+) 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();