Class ARBoundingBoxManager
A trackable manager that detects and tracks
3D bounding boxes in the physical environment. Add this component to your Unity.
Inheritance
Implements
Inherited Members
Namespace: UnityEngine .XR.ARFoundation
Assembly: Unity.XR.ARFoundation.dll
Syntax
[DefaultExecutionOrder(-2147483647)]
[DisallowMultipleComponent]
[RequireComponent(typeof(XROrigin))]
public class ARBoundingBoxManager : ARTrackableManager<XRBoundingBoxSubsystem, XRBoundingBoxSubsystemDescriptor, XRBoundingBoxSubsystem.Provider, XRBoundingBox, ARBoundingBox>, ITrackablesChanged<ARBoundingBox>
Properties
boundingBoxPrefab
Get or set the prefab to instantiate for each detected 3D bounding box. Can be null.
Declaration
public GameObject boundingBoxPrefab { get; set; }
Property Value
Type | Description |
---|---|
Game |
gameObjectName
The name to be used for the instantiated GameObject whenever a new 3D bounding box is detected.
Declaration
protected override string gameObjectName { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
Methods
Awake()
Saves a reference to the XR Origin component and initializes the BoundingBoxRaycaster
.
Declaration
protected override void Awake()
Overrides
GetPrefab()
Get the prefab to instantiate for each detected 3D bounding box. Can be null.
Declaration
protected override GameObject GetPrefab()
Returns
Type | Description |
---|---|
Game |
The Prefab which will be instantiated for each ARBounding |
Overrides
OnDisable()
Invoked when this component is disabled. Used to unregister with the ARRaycast
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Invoked when Unity enables this MonoBehaviour
. Used to register with the ARRaycast
Declaration
protected override void OnEnable()
Overrides
Raycast(Ray, TrackableType, Allocator)
Performs a raycast against all currently tracked 3D bounding boxes.
Declaration
public NativeArray<XRRaycastHit> Raycast(Ray ray, TrackableType trackableTypeMask, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | The ray, in Unity world space, to cast. |
Trackable |
trackableTypeMask | A mask of raycast types to perform. |
Allocator | allocator | The |
Returns
Type | Description |
---|---|
Native |
A new |
TryGetBoundingBox(TrackableId, out ARBoundingBox)
Attempt to retrieve an existing ARBoundingtrackableId
.
Declaration
public bool TryGetBoundingBox(TrackableId trackableId, out ARBoundingBox arBoundingBox)
Parameters
Type | Name | Description |
---|---|---|
Trackable |
trackableId | The |
ARBounding |
arBoundingBox | The output bounding box, if this method returns true. |