Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Spatial mesh bounds units?

Discussion in 'VR' started by trzy, Dec 1, 2016.

  1. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    Hi,

    I'm performing intersection testing between a box collider and the spatial mesh to determine which triangles in the mesh intersect. This seems to be working okay except for the initial gross check of the AABB (collider.bounds against mesh.bounds), which always indicates non-overlap (and thus prevents the detailed per vertex check from running) on the actual device.

    In the Editor, things are fine because the captured mesh appears to be stitched together such that the bounding box often encompasses the entire room and therefore my AABB tests nearly always pass.

    On the actual device, the spatial mesh bounds extents appear to be quite small relative to the box collider's, despite the collider being relatively tiny. I understand mesh bounds are in local space and collider bounds in world space but for spatial meshes, they are effectively the same.

    Has anyone else experienced this? What does mesh.bounds represent on HoloLens for a spatial mesh?

    Thanks,

    Bart
     
  2. pfreese

    pfreese

    Unity Technologies

    Joined:
    Feb 23, 2015
    Posts:
    85
    When you say "In the Editor, things are fine", are you testing with Holographic Simulation or Remoting, or simply running the same code with fake spatial mapping data?
     
  3. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    Fake spatial mapping data. I realized what the problem was. The spatial meshes downloaded from the device are always positioned at the origin so the mesh and renderer bounding boxes are equivalent. Not the case on the actual hardware, where although the scale is still (1,1,1), the center point is different. Using the renderer's bounds fixed the problem for me.