Skip to content

Commit 4ddeade

Browse files
sohailshafiiWkfacebook-github-bot
authored andcommitted
fix(Runtime): Check IsFinite on input position when fixing bones in LateUpdate
Summary: It might be possible that the retargeted's characters bones might not have valid positions when they are being corrected in LateUpdate. This code checks that before doing the LateUpdate correction. Reviewed By: andkim-meta Differential Revision: D48048967 fbshipit-source-id: 2b6ffdd8d6af3fac9129074d60861f1de640dca0
1 parent 330620f commit 4ddeade

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Runtime/Scripts/AnimationRigging/RetargetingLayer.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,14 @@ private void CorrectPositions()
475475
var positionOffset = _applyAnimationConstraintsToCorrectedPositions ?
476476
JointPositionAdjustments[(int)humanBodyBone].GetPositionOffset() : Vector3.zero;
477477
var oldPosition = targetJoint.position;
478-
float rtWeight = _retargetingAnimationConstraint.weight;
478+
// Make sure the joint position is valid before fixing it.
479+
if (!RiggingUtilities.IsFiniteVector3(oldPosition))
480+
{
481+
continue;
482+
}
479483

484+
float rtWeight = _retargetingAnimationConstraint.weight;
485+
480486
if (adjustment == null)
481487
{
482488
targetJoint.position =

0 commit comments

Comments
 (0)