Class MLSpatialMapper
Inheritance
MLSpatialMapper
Inherited Members
UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
Syntax
[AddComponentMenu("AR/Magic Leap/ML Spatial Mapper")]
[UsesLuminPrivilege("WorldReconstruction")]
[DisallowMultipleComponent]
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
computeNormals
When enabled, the system will compute the normals for the triangle vertices.
Declaration
public bool computeNormals { get; set; }
Property Value
currentMeshType
The current mesh type being surfaced by the subsystem provider.
Declaration
public MLSpatialMapper.MeshType currentMeshType { get; }
Property Value
density
Declaration
public float density { get; set; }
Property Value
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
fillHoleLength
Boundary distance (in meters) of holes you wish to have filled.
Declaration
public float fillHoleLength { get; set; }
Property Value
levelOfDetail
Declaration
[Obsolete("Replaced by density")]
public MLSpatialMapper.LevelOfDetail levelOfDetail { get; set; }
Property Value
meshIdToGameObjectMap
A Dictionary
which maps mesh ids to their GameObject
s.
Declaration
public Dictionary<MeshId, GameObject> meshIdToGameObjectMap { get; }
Property Value
meshParent
The parent transform for generated meshes.
Declaration
public Transform meshParent { get; set; }
Property Value
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
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
meshType
Whether to generate a triangle mesh or point cloud points.
Declaration
[Obsolete("Replaced by requestedMeshType and currentMeshType")]
public MLSpatialMapper.MeshType meshType { get; set; }
Property Value
planarize
When enabled, the system will planarize the returned mesh (planar regions will be smoothed out).
Declaration
public bool planarize { get; set; }
Property Value
pollingRate
How often to check for updates, in seconds. More frequent updates will increase CPU usage.
Declaration
public float pollingRate { get; set; }
Property Value
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
requestedMeshType
Request Magic Leap to generate a triangle mesh or point cloud points.
Declaration
public MLSpatialMapper.MeshType requestedMeshType { get; set; }
Property Value
requestVertexConfidence
When enabled, the system will generate confidence values for each vertex, ranging from 0-1.
Declaration
public bool requestVertexConfidence { get; set; }
Property Value
See Also
Methods
DensityToLevelOfDetail(Single)
Declaration
public static MLSpatialMapper.LevelOfDetail DensityToLevelOfDetail(float density)
Parameters
Type |
Name |
Description |
Single |
density |
|
Returns
DestroyAllMeshes()
Declaration
public void DestroyAllMeshes()
LevelOfDetailToDensity(MLSpatialMapper.LevelOfDetail)
Declaration
public static float LevelOfDetailToDensity(MLSpatialMapper.LevelOfDetail lod)
Parameters
Returns
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(MeshId)
'Refresh' a single mesh. This forces the mesh to be regenerated with the current settings.
Declaration
public void RefreshMesh(MeshId meshId)
Parameters
Type |
Name |
Description |
MeshId |
meshId |
The MeshId of the mesh to regenerate.
|
TryGetConfidence(MeshId, List<Single>)
Retrieve the confidence values associated with a mesh. Confidence values
range from 0..1. requestVertexConfidence must be enabled.
Declaration
public bool TryGetConfidence(MeshId meshId, List<float> confidenceOut)
Parameters
Type |
Name |
Description |
MeshId |
meshId |
The unique MeshId of the mesh.
|
List<Single> |
confidenceOut |
A List of floats, one for each vertex in the mesh.
|
Returns
Type |
Description |
Boolean |
True if confidence values were successfully retrieved for the mesh with id meshId .
|
See Also
Events
meshAdded
An event which is invoked whenever a new mesh is added
Declaration
public event Action<MeshId> meshAdded
Event Type
meshRemoved
An event which is invoked whenever an existing mesh is removed.
Declaration
public event Action<MeshId> meshRemoved
Event Type
meshUpdated
An event which is invoked whenever an existing mesh is updated (regenerated).
Declaration
public event Action<MeshId> meshUpdated
Event Type
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.