Skip to content

Commit

Permalink
fix: some issues where MoveIndependently did not properly update (#587)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore authored Dec 27, 2023
1 parent efdb5db commit f0a4db0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Runtime/MAMoveIndependently.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private void CheckChildren(Transform parent)
var deltaRot = Quaternion.Angle(localRotation, state.childLocalRot);
var deltaScale = (localScale - state.childLocalScale).sqrMagnitude;

if (deltaPos.sqrMagnitude < EPSILON && deltaRot < EPSILON && deltaScale < EPSILON)
if (deltaPos.magnitude < EPSILON && deltaRot < EPSILON && deltaScale < EPSILON)
{
Matrix4x4 childNewLocal = parent.worldToLocalMatrix * state.childWorld;

Expand Down Expand Up @@ -190,9 +190,11 @@ void OnUpdate()
var deltaRot = Quaternion.Angle(_priorFrameState.rotation, transform.rotation);
var deltaScale = (transform.lossyScale - _priorFrameState.lossyScale).sqrMagnitude;

if (deltaPos.sqrMagnitude < EPSILON && deltaRot < EPSILON && deltaScale < EPSILON) return;
if (deltaPos.magnitude < EPSILON && deltaRot < EPSILON && deltaScale < EPSILON) return;

CheckChildren();

_priorFrameState = transform.localToWorldMatrix;
}
}
}

0 comments on commit f0a4db0

Please sign in to comment.