Class ARPointCloudManager
A manager for ARTrackedObjects. Uses the XRDepthSubsystem
to recognize and track depth data in the physical environment.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Syntax
[DefaultExecutionOrder(-2147483647)]
[RequireComponent(typeof(ARSessionOrigin))]
[DisallowMultipleComponent]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@4.1/api/UnityEngine.XR.ARFoundation.ARPointCloudManager.html")]
public class ARPointCloudManager : ARTrackableManager<XRDepthSubsystem, XRDepthSubsystemDescriptor, XRPointCloud, ARPointCloud>, IRaycaster
Properties
gameObjectName
The name to be used for the GameObject
whenever a new Object is detected.
Declaration
protected override string gameObjectName { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
pointCloudPrefab
Getter/setter for the Point Cloud Prefab.
Declaration
public GameObject pointCloudPrefab { get; set; }
Property Value
Type | Description |
---|---|
GameObject |
Methods
GetPrefab()
The prefab that will be instantiated for each ARPointCloud. May be null
.
Declaration
protected override GameObject GetPrefab()
Returns
Type | Description |
---|---|
GameObject | The prefab that will be instantiated for each ARPointCloud. |
Overrides
OnAfterSetSessionRelativeData(ARPointCloud, XRPointCloud)
Invoked after each point cloud is updated with new data.
Declaration
protected override void OnAfterSetSessionRelativeData(ARPointCloud pointCloud, XRPointCloud sessionRelativeData)
Parameters
Type | Name | Description |
---|---|---|
ARPointCloud | pointCloud | The ARPointCloud being updated. |
XRPointCloud | sessionRelativeData | The new data associated with the point cloud. All spatial data is relative to the ARSessionOrigin. |
Overrides
OnDisable()
Invoked when this MonoBehaviour
is disabled. Used to unregister with the ARRaycastManager.
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Invoked when this MonoBehaviour
is enabled. Used to register with the ARRaycastManager.
Declaration
protected override void OnEnable()
Overrides
OnTrackablesChanged(List<ARPointCloud>, List<ARPointCloud>, List<ARPointCloud>)
Invokes the pointCloudsChanged event.
Declaration
protected override void OnTrackablesChanged(List<ARPointCloud> added, List<ARPointCloud> updated, List<ARPointCloud> removed)
Parameters
Type | Name | Description |
---|---|---|
List<ARPointCloud> | added | A list of objects added this frame. |
List<ARPointCloud> | updated | A list of objects updated this frame. |
List<ARPointCloud> | removed | A list of objects removed this frame. |
Overrides
Raycast(Ray, TrackableType, Allocator)
Implementation for the IRaycaster
interface. Raycasts against every point cloud.
Declaration
public NativeArray<XRRaycastHit> Raycast(Ray rayInSessionSpace, TrackableType trackableTypeMask, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Ray | rayInSessionSpace | A |
TrackableType | trackableTypeMask | The type of trackables to raycast against.
If |
Allocator | allocator | The allocator to use for the returned |
Returns
Type | Description |
---|---|
NativeArray<XRRaycastHit> | A new |
Events
pointCloudsChanged
Invoked once per frame with information about the ARTrackedObjects that have changed, i.e., been added, updated, or removed.
This happens just before ARTrackedObjects are destroyed, so you can set ARTrackedObject.destroyOnRemoval
to false
from this event to suppress this behavior.
Declaration
public event Action<ARPointCloudChangedEventArgs> pointCloudsChanged
Event Type
Type | Description |
---|---|
Action<ARPointCloudChangedEventArgs> |