Class ARPlane | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class ARPlane

    Represents a plane detected by an AR device.

    Inheritance
    System.Object
    ARPlane
    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

    normal

    Gets the normal to this plane in world space.

    Declaration
    public Vector3 normal { get; }
    Property Value
    Type Description
    Vector3

    trackingState

    Gets the current TrackingState of this ARPlane.

    Declaration
    public TrackingState trackingState { get; }
    Property Value
    Type Description
    TrackingState

    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. Space.Self refers to session space, while Space.World refers to Unity world space. The default is Space.World.

    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>
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023