Hololens/Lib/Collisions.cs
//###################################################################################################################
/// <summary>
/// Event raised for each surface detected.
/// </summary>
/// <param name="surface"> the surface detected </param>
/// <param name="generatedModel"> the collision map  </param>
Event raised for each surface detected.
Event raised for each surface detected .
public override void OnSurfaceAddedOrUpdated(SpatialMeshInfo surface, Model generatedModel)
        {
            Node node = this.Scene.GetChild(surface.SurfaceId, false);
            if (node == null) node = this.Scene.CreateChild(surface.SurfaceId);
            StaticModel staticModel = node.CreateComponent<StaticModel>();
            staticModel.Model = generatedModel;
            staticModel.Material = _transparentMaterial;
            node.Position = surface.BoundsCenter;
            node.Rotation = surface.BoundsRotation;
            StopSpatialMapping();
        }
public override void OnSurfaceAddedOrUpdated ( SpatialMeshInfo surface , Model generatedModel ) { Node node = this . Scene . GetChild ( surface . SurfaceId , false ) ; if ( node == null ) node = this . Scene . CreateChild ( surface . SurfaceId ) ; StaticModel staticModel = node . CreateComponent < StaticModel > ( ) ; staticModel . Model = generatedModel ; staticModel . Material = _transparentMaterial ; node . Position = surface . BoundsCenter ; node . Rotation = surface . BoundsRotation ; StopSpatialMapping ( ) ; }
Event raised for each surface detected.
Event raised for each surface detected .
// create a node for spatial mapping if not exist // add the spatial map to the node and set it transparent // set position and orientation of the map according to the world scene // stop spatial mapping to avoid slowness
surface
SpatialMeshInfo
the surface detected
the surface detected
generatedModel
Model
the collision map
the collision map