AnchorPolicy

class AnchorPolicy : DragPolicy


Represents the anchoring behavior of a spatial object.

An AnchorPolicy object can be placed and re-anchored on detected surfaces in the environment. This class defines properties that control how anchoring behaves, such as whether it's enabled and what types of planes it can anchor to.

This functionality requires the android.permission.SCENE_UNDERSTANDING_COARSE permission. If this permission is not granted, anchoring will be disabled and the element will behave as if this policy was not applied.

Summary

Public constructors

AnchorPolicy(
    isEnabled: Boolean,
    anchorPlaneOrientations: Set<PlaneOrientation>,
    anchorPlaneSemantics: Set<PlaneSemantic>
)

Public functions

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

Set<PlaneOrientation>

A set of PlaneOrientation values that define the orientations of planes this object can anchor to.

Set<PlaneSemantic>

A set of PlaneSemantic values that define the semantic types of planes this object can anchor to.

Boolean

Whether anchoring is enabled for this object.

Public constructors

AnchorPolicy

Added in 1.0.0-alpha07
AnchorPolicy(
    isEnabled: Boolean = true,
    anchorPlaneOrientations: Set<PlaneOrientation> = emptySet(),
    anchorPlaneSemantics: Set<PlaneSemantic> = emptySet()
)

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

anchorPlaneOrientations

Added in 1.0.0-alpha07
val anchorPlaneOrientationsSet<PlaneOrientation>

A set of PlaneOrientation values that define the orientations of planes this object can anchor to. An empty set means anchoring is not restricted by orientation. For example, PlaneOrientation.Horizontal for floors/ceilings or PlaneOrientation.Vertical for walls. Defaults to an empty set.

anchorPlaneSemantics

Added in 1.0.0-alpha07
val anchorPlaneSemanticsSet<PlaneSemantic>

A set of PlaneSemantic values that define the semantic types of planes this object can anchor to. An empty set means anchoring is not restricted by semantic type. For example, PlaneSemantic.Floor or PlaneSemantic.Wall. Defaults to an empty set.

isEnabled

Added in 1.0.0-alpha07
val isEnabledBoolean

Whether anchoring is enabled for this object. If false, the object will not be able to anchor to surfaces. Defaults to true.