2
votes

I'm working with Unity 2017.4, the HoloToolKit 2017.4.3, Vuforia and the Hololens. How can I calculate the distance of a virtual object to the spatial mapping of the Hololens? I only need the distance in the Z coordinate, like in "how many meters above the floor is my object".

1
Please add any supporting code or information about anything you've already tried.Cristian C.
the spatial mapping is providing generated mesh on runtime?Perazim

1 Answers

1
votes

As u didnt provide much information, here my first idea. Raycast from the object down to ground/ceiling and take the distance.

     RaycastHit hit = new RaycastHit();
     if (Physics.Raycast (transform.position, -Vector3.up, out hit)) {
         var distanceToGround = hit.distance;
     }