Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

SpatialSurfaceInfo::TryGetBounds seems to return wrong bounds

mlfarrellmlfarrell
edited September 2016 in Questions And Answers

Again, I'm not using Unity here, so please restrict answers to the actual Platform SDK.

I'm trying to get a world-space oriented bounding box of the spatial surfaces but the results are tilted on their side and in the wrong position.... and seemingly the wrong scale. At first I figured it was okay because these are oriented boxes, but ALL of them are tilted the same amount and I was expecting them to at least be flat w.r.t. the floor.

Edit: It gets even weirder, all the extent scale values are coming back identical regardless of the surface. Is this a bug in the SDK?

Code:

      SpatialCoordinateSystem ^currentCoordinateSystem = referenceFrame->CoordinateSystem;  //stationary, same as rest of app
      auto bounds = newSurface->TryGetBounds(currentCoordinateSystem);

   //........
          if(auto updatedBounds = bounds)
          {
            float3 pos = float3(updatedBounds->Value.Center.x, updatedBounds->Value.Center.y, updatedBounds->Value.Center.z);
            float3 scale = float3(updatedBounds->Value.Extents.x, updatedBounds->Value.Extents.y, updatedBounds->Value.Extents.z);
            QUAT q = { updatedBounds->Value.Orientation.x, updatedBounds->Value.Orientation.y, updatedBounds->Value.Orientation.z, updatedBounds->Value.Orientation.w }; //my QUAT is in format X, Y, Z, W
            cube->second->setPos(pos);
            cube->second->setScale(scale); 
            cube->second->setRotationQuat(q);
          }

Any idea what I could be doing wrong here?

Best Answer

Answers

  • Options

    Without this working, I'm going to be forced to compute the bounds manually myself in a concurrent task..

  • Options

    I must say, its extremely frustrating that this API isn't working. I'm losing hours of valuable dev time on manually trying to get a working bounding box with all the transforms. Where can I file a bug report for this??

  • Options

    Hello,

    I'm currently working with TryGetBounds and it's not working the way I expect either.

    What I'm wondering, is what the order of operations their expecting and what you (and I) are applying.

    The documentation says that the bounds returned are in the requested coordinate system, does this mean that the box is at Center, with Extents rotated by Rotation? Or is the box at Center with Extents, rotated by Rotation? Currently, our code assumes the former.

    I will continue experimenting, but I agree it is incredibly frustrating to be plodding along in the dark.

    @Patrick Any possible feedback for this code?

  • Options
    Honestly man, it's broke. I ended up writing my own bounds calculation method along with Ray casting against it with forward and inverse transforms to get into/from normalized box space. Performance is decent since I do it off thread alongside the buffer creation. Sometimes with prerelease software like this, you have to bite the bullet and do things manually..
Sign In or Register to comment.