Class MLSpatialMapper
Inheritance
Namespace: UnityEngine.XR.MagicLeap
Syntax
public sealed class MLSpatialMapper : MonoBehaviour
Properties
batchSize
How many meshes to update per batch. Larger values are more efficient, but have higher latency.
Declaration
public int batchSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
computeNormals
When enabled, the system will compute the normals for the triangle vertices.
Declaration
public bool computeNormals { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
disconnectedComponentArea
Any component that is disconnected from the main mesh and which has an area less than this size will be removed.
Declaration
public float disconnectedComponentArea { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
fillHoleLength
Boundary distance (in meters) of holes you wish to have filled.
Declaration
public float fillHoleLength { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
levelOfDetail
Declaration
public MLSpatialMapper.LevelOfDetail levelOfDetail { get; set; }
Property Value
| Type | Description |
|---|---|
| MLSpatialMapper.LevelOfDetail |
meshIdToGameObjectMap
A Dictionary which maps mesh ids to their GameObjects.
Declaration
public Dictionary<TrackableId, GameObject> meshIdToGameObjectMap { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.Dictionary<TrackableId, GameObject> |
meshParent
The parent transform for generated meshes.
Declaration
public Transform meshParent { get; set; }
Property Value
| Type | Description |
|---|---|
| Transform |
meshPrefab
Get or set the prefab which should be instantiated to create individual mesh instances. May have a mesh renderer and an optional mesh collider for physics.
Declaration
public GameObject meshPrefab { get; set; }
Property Value
| Type | Description |
|---|---|
| GameObject |
meshQueueSize
Controls the number of meshes to queue for generation at once. Larger numbers will lead to higher CPU usage.
Declaration
public uint meshQueueSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.UInt32 |
meshType
Whether to generate a triangle mesh or point cloud points.
Declaration
public MLSpatialMapper.MeshType meshType { get; set; }
Property Value
| Type | Description |
|---|---|
| MLSpatialMapper.MeshType |
planarize
When enabled, the system will planarize the returned mesh (planar regions will be smoothed out).
Declaration
public bool planarize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
pollingRate
How often to check for updates, in seconds. More frequent updates will increase CPU usage.
Declaration
public float pollingRate { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
removeMeshSkirt
When enabled, the mesh skirt (overlapping area between two mesh blocks) will be removed. This field is only valid when the Mesh Type is Blocks.
Declaration
public bool removeMeshSkirt { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
requestVertexConfidence
When enabled, the system will generate confidence values for each vertex, ranging from 0-1.
Declaration
public bool requestVertexConfidence { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
See Also
Methods
DestroyAllMeshes()
Destroy all mesh GameObjects created by this MLSpatialMapper.
The meshIdToGameObjectMap will also be cleared.
Declaration
public void DestroyAllMeshes()
RefreshAllMeshes()
'Refresh' all known meshes (meshes that are in meshIdToGameObjectMap). This will force all meshes to be regenerated with the current settings.
Declaration
public void RefreshAllMeshes()
RefreshMesh(TrackableId)
'Refresh' a single mesh. This forces the mesh to be regenerated with the current settings.
Declaration
public void RefreshMesh(TrackableId meshId)
Parameters
| Type | Name | Description |
|---|---|---|
| TrackableId | meshId | The |
TryGetConfidence(TrackableId, List<Single>)
Retrieve the confidence values associated with a mesh. Confidence values range from 0..1. requestVertexConfidence must be enabled.
Declaration
public bool TryGetConfidence(TrackableId meshId, List<float> confidenceOut)
Parameters
| Type | Name | Description |
|---|---|---|
| TrackableId | meshId | The unique |
| System.Collections.Generic.List<System.Single> | confidenceOut | A |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if confidence values were successfully retrieved for the mesh with id |
See Also
Events
meshAdded
An event which is invoked whenever a new mesh is added
Declaration
public event Action<TrackableId> meshAdded
Event Type
| Type | Description |
|---|---|
| System.Action<TrackableId> |
meshRemoved
An event which is invoked whenever an existing mesh is removed.
Declaration
public event Action<TrackableId> meshRemoved
Event Type
| Type | Description |
|---|---|
| System.Action<TrackableId> |
meshUpdated
An event which is invoked whenever an existing mesh is updated (regenerated).
Declaration
public event Action<TrackableId> meshUpdated
Event Type
| Type | Description |
|---|---|
| System.Action<TrackableId> |