AnchorPlacement


public final 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 methods

static final @NonNull AnchorPlacement
createForPlanes(
    @NonNull Set<@NonNull Integer> anchorablePlaneOrientations,
    @NonNull Set<@NonNull Integer> anchorablePlaneSemanticTypes
)

Creates an anchor placement for anchoring to planes.

boolean
equals(Object other)
final @NonNull Set<@NonNull Integer>
final @NonNull Set<@NonNull Integer>
int
@NonNull String

Public methods

createForPlanes

Added in 1.0.0-alpha05
public static final @NonNull AnchorPlacement createForPlanes(
    @NonNull Set<@NonNull Integer> anchorablePlaneOrientations,
    @NonNull Set<@NonNull Integer> anchorablePlaneSemanticTypes
)

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
@NonNull Set<@NonNull Integer> anchorablePlaneOrientations

The set of plane types to filter by.

@NonNull Set<@NonNull Integer> anchorablePlaneSemanticTypes

The set of plane semantics to filter by.

equals

public boolean equals(Object other)

getAnchorablePlaneOrientations

Added in 1.0.0-alpha05
public final @NonNull Set<@NonNull IntegergetAnchorablePlaneOrientations()

getAnchorablePlaneSemanticTypes

Added in 1.0.0-alpha05
public final @NonNull Set<@NonNull IntegergetAnchorablePlaneSemanticTypes()

hashCode

public int hashCode()

toString

public @NonNull String toString()