Fix stretchy arm for hand stuck behind static object
This commit is contained in:
parent
879a715b09
commit
1e7dc01762
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user