Just started developing an application for the hololens and so far I managed to get the environment and everything working within the hololens and VS 2015 u3 build.
Now I am trying to figure out how to create and detect collision so the player or main camera does not go through walls and objects. Like adding a box collider to a cube so the fps controller doesn’t go through.
Do I have to apply spatial mapping renderer and spatial mapping collider in the object I want to add collision to?
What else do I need to apply, for example, do I add anything to the main camera like a rigid body or box collider?
Do I treat collisions like I do in normal 3d without hololens?
I’m a bit confused about the question, but it sounds like you’re asking how to restrict the movement of the player with respect to virtual game objects - if I’m right about that, the answer is, “You can’t.” The HoloLens reports the position and rotation of the device, and we apply that to the camera - there is no feedback system to make the player hit an imaginary wall.
The video you mentioned must have had something written into the drone to keep it from hitting virtual walls - or the drone was virtual, not sure, I haven’t seen the video you’re talking about. The human equivalent would just be telling them not to go through the walls and hoping they don’t cheat. I suppose you could just restart the level or something if they do hit a wall.
Like I said, there is no feedback system to make the player hit an imaginary wall.
I think there’s just a simple misunderstanding here about how spatial mapping and how the colliders work. HoloLens provides a means with which to have virtual objects react to the real world, and not the other way around. So in the video you posted above, that’s a virtual drone colliding with a real world wall - that’s how collision works with spatial mapping. It basically just boils down to a system where we make a collision mesh out of what the HoloLens reports as a surface, and then the usual Unity physics kick in - that mesh just doesn’t have a renderer so you can’t see it, but the collision mesh is there.
You can play around with that by just dropping the SpatialMappingCollider component in your scene (probably on the main camera).
Kind of confused about your question with the cube. There’s no need to apply collision to the player unless you want to respond to when it collides with something, but there’s no way to push the player back from when they cross a virtual wall.