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

Placement of a cube and spatial mapping

Hi guys,
In my app I pick up a sphere with the tap gesture and move it where I want by moving the finger (without spatial mapping). Now I added spatial mapping and want to put the hologram on a physical object e.g. a desk.
I made a gameobject and added the spatialmapping collider and the spatial mapping renderer object.
When I pick up the object I could move it through real objects.
Do you know how to solve this issue?

Chris

Tagged:

Best Answers

Answers

  • Options
    stepan_stulovstepan_stulov ✭✭✭
    edited March 2018

    Hey, @ChristophMarko

    Assuming all your collider, rigidbody and layer matrix are set up correctly. Seems like you have a conflict of two transform-altering systems: one changing object's transform programmatically via code (syncing its position with the camera / TapToPlace / IXyzHandler) and another changing it via physics system (colliders colliding). Physics would be happy to let the collider rest on the table but you neutralize that effect by setting the coordinates yourself. Such situations are common and you generally have to decide which one has the authority. Or combine them in a certain way with one having the authority some of the time and another the rest of the time. For examply disable the colliders/rigidbodies or set isKinematic to true while carrying the object and set it all back when releasing.

    https://forums.hololens.com/discussion/comment/15033

    Cheers

    Building the future of holographic navigation. We're hiring.

  • Options

    @stepan_stulov Thank you for fast response and the information ;)
    I will test your suggest.
    I have another question I want to prevent my cube to go into the spatial mesh.
    At the tim, my cube has a rigidbody and a collider upon it. I got the collision info via TriggerEvent like I did it for the ready and the tapped gesture to interact with the cube.
    For the movement of the cube and the ready/ pressed gesture icon I used the transform.position.
    Do you know how I could prevent that the object gets into the spatial mesh of real objects?

  • Options

    @stepan_stulov do you know a method how to prevent virtual GO to move into the spatial mesh?

  • Options
    stepan_stulovstepan_stulov ✭✭✭
    edited March 2018

    Hey, @ChristophMarko

    Yes, I do.

    I recommend learning about all participating components of the Unity's physics system, namely the colliders (whose boundaries defined by meshes) and rigid bodies. Also about the isTrigger of colliders and isKinematic of rigidbodies. Also learn about the layer collision matrix.

    Now it's time to learn what spatial mapping is. How a reconstructed spatial mesh is fed into the spatial mapping collider, how that mesh gets updated, what layer it's in.

    Finally, you want to learn about gaze and gestures and how a game object's transform is controlled programmatically via them.

    Having understood all this you will identify what exactly the conflict seems to be and why the game object falls through the spatial mapping when it is not supposed to.

    The problem will thus resolve itself with ease.

    PS: One might notice how I am not a fan of quick thoughtless solutions. I highly appreciate not receiving a negative feedback for it even if such appears to be tempting.

    Building the future of holographic navigation. We're hiring.

  • Options

    hi @stepan_stulov thank you for your hints ;)
    I solved the problem with the object falling trough the mesh.
    I also tried a lot with moving an object by the rigidbody.MovePosition but this neither works. I set all the necessary parts for the collision matrix.

  • Options

    My actual problem is when I want to move the cube the spatial mesh will be activated and I am able to move it towards the mesh.
    I applied a rigidbody with a collider and didn't set IsTrigger. Therefore I thought there is a problem between the moveposition and the physics part of unity.

  • Options

    @ChristophMarko You linked this in another thread as being your main problem but I am unclear what you are still missing. @stepan_stulov seems to have answered your issues here?

    You say 'I solved the problem with the object falling trough the mesh.'

    Then:
    'My actual problem is when I want to move the cube the spatial mesh will be activated and I am able to move it towards the mesh.'

    I am not sure what this second line means or what you are still asking at this point.

    Taqtile

Sign In or Register to comment.