Class ARHumanBodyManager
The manager for the human body subsystem.
Inheritance
Implements
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Assembly: Unity.XR.ARFoundation.dll
Syntax
[DisallowMultipleComponent]
[DefaultExecutionOrder(-2147483647)]
[AddComponentMenu("XR/AR Foundation/AR Human Body Manager")]
public sealed class ARHumanBodyManager : ARTrackableManager<XRHumanBodySubsystem, XRHumanBodySubsystemDescriptor, XRHumanBodySubsystem.Provider, XRHumanBody, ARHumanBody>, ITrackablesChanged<ARHumanBody>
Remarks
Related information: Body tracking
Properties
gameObjectName
The name for any generated GameObjects.
Declaration
protected override string gameObjectName { get; }
Property Value
Type | Description |
---|---|
string | The name for any generated GameObjects. |
Overrides
humanBodyPrefab
The Prefab object to instantiate at the location of the human body origin.
Declaration
public GameObject humanBodyPrefab { get; set; }
Property Value
Type | Description |
---|---|
GameObject | The Prefab object to instantiate at the location of the human body origin. |
pose2DEnabled
Whether 2D human pose estimation is enabled. While pose2DRequested tells you whether 2D pose estimation has been requested, this property tells you whether 2D pose estimation is currently active in the subsystem.
Declaration
public bool pose2DEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
pose2DRequested
Whether 2D human pose estimation is requested.
Declaration
public bool pose2DRequested { get; set; }
Property Value
Type | Description |
---|---|
bool |
|
pose3DEnabled
Whether 3D human pose estimation is enabled.
Declaration
public bool pose3DEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
pose3DRequested
Whether 3D human pose estimation is requested.
Declaration
public bool pose3DRequested { get; set; }
Property Value
Type | Description |
---|---|
bool |
|
pose3DScaleEstimationEnabled
Whether 3D human body scale estimation is enabled.
Declaration
public bool pose3DScaleEstimationEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
pose3DScaleEstimationRequested
Whether 3D human body scale estimation is requested.
Declaration
public bool pose3DScaleEstimationRequested { get; set; }
Property Value
Type | Description |
---|---|
bool |
|
Methods
GetHumanBody(TrackableId)
Get the human body matching the trackable identifier.
Declaration
public ARHumanBody GetHumanBody(TrackableId trackableId)
Parameters
Type | Name | Description |
---|---|---|
TrackableId | trackableId | The trackable identifier for querying a human body trackable. |
Returns
Type | Description |
---|---|
ARHumanBody | The human body trackable, if found. Otherwise, |
GetHumanBodyPose2DJoints(Allocator)
Gets the human body pose 2D joints for the current frame.
Declaration
public NativeArray<XRHumanBodyPose2DJoint> GetHumanBodyPose2DJoints(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | The allocator to use for the returned array memory. |
Returns
Type | Description |
---|---|
NativeArray<XRHumanBodyPose2DJoint> | The array of body pose 2D joints. |
Remarks
The returned array might be empty if the system is not enabled for human body pose 2D or if the system does not detect a human in the camera image.
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown if the implementation does not support human body pose 2D. |
GetPrefab()
Gets the Prefab object to instantiate at the location of the trackable.
Declaration
protected override GameObject GetPrefab()
Returns
Type | Description |
---|---|
GameObject | A GameObject to instantiate at the location of the trackable, or |
Overrides
OnAfterSetSessionRelativeData(ARHumanBody, XRHumanBody)
Callback after the session relative data has been set to update the skeleton for the human body.
Declaration
protected override void OnAfterSetSessionRelativeData(ARHumanBody arBody, XRHumanBody xrBody)
Parameters
Type | Name | Description |
---|---|---|
ARHumanBody | arBody | The human body trackable being updated. |
XRHumanBody | xrBody | The raw human body data from the subsystem. |
Overrides
OnBeforeStart()
Callback before the subsystem is started (but after it is created).
Declaration
protected override void OnBeforeStart()
Overrides
OnDestroy()
Callback as the manager is being destroyed.
Declaration
protected override void OnDestroy()
Overrides
OnTrackablesChanged(List<ARHumanBody>, List<ARHumanBody>, List<ARHumanBody>)
Callback when the trackable deltas are being reported.
Declaration
[Obsolete("OnTrackablesChanged() has been deprecated in AR Foundation version 6.0.", false)]
protected override void OnTrackablesChanged(List<ARHumanBody> added, List<ARHumanBody> updated, List<ARHumanBody> removed)
Parameters
Type | Name | Description |
---|---|---|
List<ARHumanBody> | added | The list of human bodies added to the set of trackables. |
List<ARHumanBody> | updated | The list of human bodies updated in the set of trackables. |
List<ARHumanBody> | removed | The list of human bodies removed to the set of trackables. |
Overrides
Events
humanBodiesChanged
The event that is fired when a change to the detected human bodies is reported.
Declaration
[Obsolete("humanBodiesChanged has been deprecated in AR Foundation version 6.0. Use trackablesChanged instead.", false)]
public event Action<ARHumanBodiesChangedEventArgs> humanBodiesChanged
Event Type
Type | Description |
---|---|
Action<ARHumanBodiesChangedEventArgs> |