Meshes are generated in "device space", also know as "session relative space". The transform's localPosition, localRotation, and localScale are used for this calculation.Ī green, transparent box is drawn in Unity's Scene View to indicate the area in which meshing will occur: The MLSpatialMapper's transform is used to define this region. Meshes are only generated inside a specific region, relative to the Magic Leap One's starting position. If true, the mesh skirt (overlapping area between two meshes) will be removed. If true, the system will compute the confidence values for each vertex, ranging from 0 to 1. If true, the system will planarize the returned mesh (planar regions will be smoothed out).Īny component that is disconnected from the main mesh and which has an area (in meters squared) less than this size will be removed. Larger values are more efficient, but have higher latency. Maximum number of meshes to update per batch. More frequent updates will increase CPU usage. How often to check for updates, in seconds. Perimeter (in meters) of holes you wish to have filled. Larger values will lead to heavier CPU usage, but will generate meshes faster. Each frame, the MLSpatialMapper will add meshes to a generation queue as necessary. The number of concurrent meshes to generate. Higher density meshes require more CPU and GPU resources. The scale goes from low density at 0 (big triangles) to high density at 1 (small triangles). This property is deprecated, and has been replaced by density.Ĭontrols the size and spacing of triangles in meshes.
Higher LOD levels will be more accurate, but require more CPU and GPU resources. Lower levels of detail will result in simplified meshes, and will reduce CPU and GPU load, but will be less accurate.
If you select point cloud, then the resulting Mesh will have MeshTopology.Points. Whether to generate triangle meshes or a point cloud. By default, the MLSpatialMapper will select its own parent, so that the generated meshes will be siblings of the MLSpatialMapper's GameObject. The parent transform for the generated meshes. If false, normals will be calculated from the triangle data. If true, will request that the device also generate a normal for each vertex. This happens on a background thread, so it will not stall the main thread. If a MeshCollider is present, then a physics collider will be generated as well. To visualize the meshes, add a MeshRenderer. The prefab should at least have a MeshFilter on it. This is the prefab that will be instantiated for each generated mesh. A separate GameObject is created for each generated mesh. Each mesh is a relatively small area of the environment. The spatial mapper generates Mesh objects from data collected from the Magic Leap One's depth sensor. This package includes the MLSpatialMapper component: Inclusion of the Magic Leap XR Support will result in the inclusion of a C# component, runtime libraries, and plugin metadata. The Magic Leap XR Support implements the native endpoints required for meshing using Unity's multi-platform XR API.
To install this package, follow the instructions in the Package Manager documentation.