AnchorPlacement


class AnchorPlacement


AnchorPlacement for setting how an Entity should be anchored in a MovableComponent.

When an AnchorPlacement is added to a MovableComponent, the attached Entity may be automatically anchored and reparented to a new Entity at the end of the movement.

Summary

Public companion functions

AnchorPlacement
createForPlanes(
    anchorablePlaneOrientations: Set<Int>,
    anchorablePlaneSemanticTypes: Set<Int>
)

Creates an anchor placement for anchoring to planes.

Public functions

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

Public companion functions

createForPlanes

Added in 1.0.0-alpha05
fun createForPlanes(
    anchorablePlaneOrientations: Set<Int> = setOf(PlaneOrientation.ANY),
    anchorablePlaneSemanticTypes: Set<Int> = setOf(PlaneSemanticType.ANY)
): AnchorPlacement

Creates an anchor placement for anchoring to planes.

Setting a PlaneOrientation or PlaneSemanticType filter means that the Entity with a MovableComponent will be anchored to a plane of that matches at least one of the specified PlaneOrientation filters and at least one specified PlaneSemanticType filters if it is released nearby. By default this the Entity will be anchored to any plane. If no PlaneOrientation or no PlaneSemanticType is set the Entity will not be anchored. This setting requires androidx.xr.runtime.Session.configure to be called with androidx.xr.runtime.Config.PlaneTrackingMode.HORIZONTAL_AND_VERTICAL in order to be able to discover planes.

When an Entity is anchored to the plane the pose will be rotated so that it's Z-vector will be pointing out of the plane (i.e. if it is a panel it will be flat along the plane). The EntityMoveListener.onMoveEnd callback can be used to listen for the Entity being anchored, reanchored, or unanchored. When anchored the parent will be updated to a new anchor Entity. When unanchored the parent will be set to the ActivitySpace.

Parameters
anchorablePlaneOrientations: Set<Int> = setOf(PlaneOrientation.ANY)

The set of plane types to filter by.

anchorablePlaneSemanticTypes: Set<Int> = setOf(PlaneSemanticType.ANY)

The set of plane semantics to filter by.

Public functions

equals

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

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

anchorablePlaneOrientations

Added in 1.0.0-alpha05
val anchorablePlaneOrientationsMutableSet<Int>

anchorablePlaneSemanticTypes

Added in 1.0.0-alpha05
val anchorablePlaneSemanticTypesMutableSet<Int>