Class ARPlane
Represents a plane detected by an AR device.
Inheritance
Namespace: UnityEngine.XR.ARFoundation
Syntax
public sealed class ARPlane : MonoBehaviour
Remarks
Generated by the ARPlaneManager when an AR device detects a plane in the environment.
Properties
boundedPlane
The BoundedPlane data struct which defines this ARPlane
Declaration
public BoundedPlane boundedPlane { get; }
Property Value
| Type | Description |
|---|---|
| BoundedPlane |
destroyOnRemoval
If true, this component's GameObject will be removed immediately when the plane is removed.
Declaration
public bool destroyOnRemoval { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
Setting this to false will keep the plane'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 |
vertexChangedThreshold
The largest value by which a plane's vertex may change before the mesh is regenerated. Units are in session-space meters.
Declaration
public float vertexChangedThreshold { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Methods
PositionsAreApproximatelyEqual(List<Vector3>, List<Vector3>, Single)
Checks if each set of positions are equal to within some tolerance.
Declaration
public static bool PositionsAreApproximatelyEqual(List<Vector3> positions1, List<Vector3> positions2, float tolerance)
Parameters
| Type | Name | Description |
|---|---|---|
| List<Vector3> | positions1 | The first set of positions |
| List<Vector3> | positions2 | The second set of positions |
| System.Single | tolerance | Positions in the first set must be within this value to the positions in the second set to be considered equal. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if all positions are approximately equal, false if any of them are not, or if the number of positions in the sets differs. |
TryGetBoundary(List<Vector3>, Space)
Attempts to retrieve the boundary points of the plane.
Declaration
public bool TryGetBoundary(List<Vector3> boundaryOut, Space space = null)
Parameters
| Type | Name | Description |
|---|---|---|
| List<Vector3> | boundaryOut | If successful, the contents are replaced with the ARPlane's boundary points. |
| Space | space | Which coordinate system to use. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the boundary was successfully retrieved. |
Events
boundaryChanged
Invoked when any vertex in the plane's polygon changes by more than vertexChangedThreshold.
Declaration
public event Action<ARPlaneBoundaryChangedEventArgs> boundaryChanged
Event Type
| Type | Description |
|---|---|
| Action<ARPlaneBoundaryChangedEventArgs> |
Remarks
The data is provided in plane-relative space. That is, relative to the
ARPlane's localPosition and localRotation.
Units are in session-space meters.
removed
Invoked just before the plane is about to be removed.
Declaration
public event Action<ARPlane> removed
Event Type
| Type | Description |
|---|---|
| Action<ARPlane> |
updated
Invoked whenever the plane updates
Declaration
public event Action<ARPlane> updated
Event Type
| Type | Description |
|---|---|
| Action<ARPlane> |