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(Creates an anchor placement for anchoring to planes. |
boolean |
|
final @NonNull Set<@NonNull Integer> |
|
final @NonNull Set<@NonNull Integer> |
|
int |
hashCode() |
@NonNull String |
toString() |
Public methods
createForPlanes
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.
getAnchorablePlaneOrientations
public final @NonNull Set<@NonNull Integer> getAnchorablePlaneOrientations()
getAnchorablePlaneSemanticTypes
public final @NonNull Set<@NonNull Integer> getAnchorablePlaneSemanticTypes()