Class ARFace
Represents a face detected by an AR device.
Inheritance
Namespace: UnityEngine.XR.ARFoundation
Syntax
public sealed class ARFace : MonoBehaviour
Remarks
Generated by the ARFaceManager when an AR device detects a face in the environment.
Properties
destroyOnRemoval
If true, this component's GameObject
will be removed immediately when the face is removed.
Declaration
public bool destroyOnRemoval { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Setting this to false will keep the face's GameObject
around. You may want to do this, for example,
if you have custom removal logic, such as a fade out.
lastUpdatedFrame
The last frame on which this plane was updated.
Declaration
public int lastUpdatedFrame { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
trackingState
Gets the current TrackingState
of this ARFace.
Declaration
public TrackingState trackingState { get; }
Property Value
Type | Description |
---|---|
TrackingState |
xrFace
The XRFace
data struct which defines this ARFace.
Declaration
public XRFace xrFace { get; }
Property Value
Type | Description |
---|---|
XRFace |
Methods
TryGetFaceMeshIndices(List<Int32>)
Fills in the List of int that are the face mesh triangle indices.
Declaration
public bool TryGetFaceMeshIndices(List<int> indicesOut)
Parameters
Type | Name | Description |
---|---|---|
List<System.Int32> | indicesOut | If successful, the contents are replaced with the ARFace's mesh triangle indices. |
Returns
Type | Description |
---|---|
System.Boolean | True if the mesh triangle indices were successfully retrieved. |
TryGetFaceMeshUVs(List<Vector2>)
Attempt to fill in the List of Vector2 that are the face mesh texture coordinates.
Declaration
public bool TryGetFaceMeshUVs(List<Vector2> uvsOut)
Parameters
Type | Name | Description |
---|---|---|
List<Vector2> | uvsOut | If successful, the contents are replaced with the ARFace's mesh texture coordinates. |
Returns
Type | Description |
---|---|
System.Boolean | True if the mesh texture coordinates were successfully retrieved. |
TryGetFaceMeshVertices(List<Vector3>)
Attempts to fill in the List of Vector3 with the face mesh vertex positions in face space.
Declaration
public bool TryGetFaceMeshVertices(List<Vector3> verticesOut)
Parameters
Type | Name | Description |
---|---|---|
List<Vector3> | verticesOut | If successful, the contents are replaced with the ARFace's mesh vertex positions. |
Returns
Type | Description |
---|---|
System.Boolean | True if the mesh vertex positions were successfully retrieved. |
Events
removed
Invoked just before the face is about to be removed.
Declaration
public event Action<ARFace> removed
Event Type
Type | Description |
---|---|
Action<ARFace> |
updated
Invoked whenever the face updates
Declaration
public event Action<ARFace> updated
Event Type
Type | Description |
---|---|
Action<ARFace> |