Skip to content

Commit 2003e66

Browse files
danielhofmann-mskeveleigh
authored andcommitted
Fix updating collider bounds on transform change in bounding box script
1 parent bccda55 commit 2003e66

File tree

1 file changed

+3
-3
lines changed
  • Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/BoundingBox

1 file changed

+3
-3
lines changed

Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/BoundingBox/BoundingBox.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -946,17 +946,17 @@ private void UpdateBounds()
946946
{
947947
if (cachedTargetCollider != null)
948948
{
949-
Vector3 boundsExtents = Vector3.zero;
950-
951949
// Store current rotation then zero out the rotation so that the bounds
952950
// are computed when the object is in its 'axis aligned orientation'.
953951
Quaternion currentRotation = targetObject.transform.rotation;
954952
targetObject.transform.rotation = Quaternion.identity;
953+
Physics.SyncTransforms(); // Update collider bounds
955954

956-
boundsExtents = cachedTargetCollider.bounds.extents;
955+
Vector3 boundsExtents = cachedTargetCollider.bounds.extents;
957956

958957
// After bounds are computed, restore rotation...
959958
targetObject.transform.rotation = currentRotation;
959+
Physics.SyncTransforms();
960960

961961
if (boundsExtents != Vector3.zero)
962962
{

0 commit comments

Comments
 (0)