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.

Collision between player with glasses (camera) and hologram character

Hi. I thinking about collisions between player wearing glasses and holograms. Do I need to add a collider to another game object (representing player) connected with camera? What's recommended way of doing such things in Unity? I have found interesting thread on https://forums.hololens.com/discussion/572/got-my-game-idea-stealth but with any code. Any samples or code or good resources on Internet?

Tagged:

Best Answer

Answers

  • Holograms like player also walking on a floor.

  • Thnx very much for answer, I'll try your tips. You really helped me. Btw I have found a quite interesting article about similar things on https://hololens.reality.news/how-to/hololens-dev-101-create-user-location-hotspots-trigger-events-with-hololens-0176979/. It uses a sphere collider on HoloLens camera directly, but it's not advanced to scale it to the user height dynamically. Do you think it could be possible to use a collider attached directly to camera with height based on distance between camera position and raycast down point with floor or using a cube is necessary? In my case the best collider would be a capsule, but I could try another shapes like cube or even sphere.

  • @Jarrod1937 writing "by creating a box with collider that is attached to the main camera" you thought about box attached to camera and collider attached to box or just a box collider attached to camera. In the thread on https://forums.hololens.com/discussion/572/got-my-game-idea-stealth you mentioned about second option (collider attached to camera), I'm right?

  • Jarrod1937Jarrod1937 ✭✭✭

    For testing purposes I did an actual box with an attached collider. This allows some level of visualizing things. However, you can just add a collider to the camera directly or via script.

  • Thnx. I have started building a box with collider / a collider attached to main camera. But I have a new question. A collider attached below main camera on floor could be a problem when I raycast down from camera to floor to measure distance? How to resolve it?

  • Maybe, should I placed camera inside of a collider to have collision with floor?

  • trzytrzy ✭✭✭

    Use layers to restrict your raycast to particular classes of objects. Right now, if you look at your camera object's inspector window, in the upper right, you'll see that the Layer is set to Default. You should either create a custom layer for all other app objects or alternatively set the camera layer to one that is not part of Physics.DefaultRaycastLayers (https://docs.unity3d.com/ScriptReference/Physics.DefaultRaycastLayers.html), such as the "Ignore Raycast" layer.

  • Thank you for your tip. It has helped me. I have box in IgnoreRaycast layer under camera and measuring distance with raycast works well, but I have one more problem. I'm using path finding with dynamic NavMeshAgents. Before placing box under camera on floor characters were going towards camera (me), but now they aren't moving properly. Maybe because their target point under camera is inaccessible because of box. How can I solve it?

  • I have managed with it using position of cube (player), not point under camera covered with it. I don't know if my solution is ideal, maybe in my case capsule collider would be better, but something started working...

Sign In or Register to comment.