MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Problematic BoundingBox bounds setting & calculations

Open Troy-Ferrell opened this issue 7 years ago • 8 comments

Describe the bug

The BoundingBox components code path for calculating bounds has various issues depending on certain cases & uses.

  1. Bounds Overide property is private [SerializedField] and thus cannot be set at runtime. For example, one customer loads model file dynamically and AddComponent() but cannot set the bounds override.

Issues with BoundingBox.GetTargetBounds() 2) The first phase of the method looks at children objects that are not part of the BB rig. However, the code only takes into account direct children of the Target object and not sub-children. (Also, code can be simplified to be foreach (Transform child in transform) {} )

  1. GetSingleObjectBounds() is not accurate as a default BoxCollider added to an empty gameobject will be center <0,0,0> but size <1,1,1> which will pass the zero size check in the algorithm

  2. The next stage of the algorithm can be simplified by leveraging the existing code in MRTK of Transform.GetColliderBounds() which does the exact same thing

  3. There is also already an enum in GetTargetBounds() for what type of bounds calculation was utilized. It would actually be nice to have this setting visible to the user for them to choose which method of bounds calculation should be utilized.

Related issues: #4557 BoundingBox doesn't recompute bounds when boundsOverride is modified

#4434 Bounding box scaling varies based on whether the box is directly on the target/collider or parented to it

To reproduce

Notice sub-children beyond L1 are not considered even if they have colliders attached Notice empty game objects having impact on bounds calculation when using encapsulation

Expected behavior

  1. Making BoundsOverride public settable property like other updated properties (ShowWireframe etc)

  2. GetTargetBounds() when calculating bounds on first attempt, should look at all children in hierarchy of target, not just L1

  3. Empty gameobjects should be ignored for calculating bounds.

  4. Re-use code of GetColliderBounds() already in MRTK to reduce redundancy

Screenshots

If applicable, add screenshots to help explain your problem.

Your Setup (please complete the following information)

  • Unity Version 2018.4
  • MRTK Version RC2 (latest right before launch

Target Platform (please complete the following information)

  • HoloLens
  • HoloLens 2
  • WMR immersive
  • OpenVR

Additional context

Add any other context about the problem here.

Troy-Ferrell avatar Jun 06 '19 17:06 Troy-Ferrell

#5307 Fixes 3.

Alexees avatar Jul 15 '19 09:07 Alexees

The current code looks like as if BoundsOverride can be set via property

Alexees avatar Jul 15 '19 15:07 Alexees

@thalbern FYI in case any of this overlaps for the new UX design

Troy-Ferrell avatar Nov 19 '19 22:11 Troy-Ferrell

This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.

stale[bot] avatar Apr 18 '20 05:04 stale[bot]

@thalbern Is this fixed (or will be fixed) in any of the current bounds control / bounding box work?

keveleigh avatar Apr 21 '20 18:04 keveleigh

This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.

stale[bot] avatar Sep 20 '20 03:09 stale[bot]

@Troy-Ferrell @polar-kev Can we please close this since it was fixed? Thanks!

BillingsAm3 avatar Oct 01 '20 16:10 BillingsAm3

@BillingsAm3 thanks for following up on this.

polar-kev avatar Oct 01 '20 21:10 polar-kev