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(Creates an anchor placement for anchoring to planes. |
Public properties |
|
|---|---|
Set<PlaneOrientation> |
|
Set<PlaneSemanticType> |
Public companion functions
createForPlanes
fun createForPlanes(
anchorablePlaneOrientations: Set<PlaneOrientation> = PlaneOrientation.ALL,
anchorablePlaneSemanticTypes: Set<PlaneSemanticType> = PlaneSemanticType.ALL
): 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.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<PlaneOrientation> = PlaneOrientation.ALL |
The set of plane types to filter by. |
anchorablePlaneSemanticTypes: Set<PlaneSemanticType> = PlaneSemanticType.ALL |
The set of plane semantics to filter by. |
Public functions
Public properties
anchorablePlaneOrientations
val anchorablePlaneOrientations: Set<PlaneOrientation>
anchorablePlaneSemanticTypes
val anchorablePlaneSemanticTypes: Set<PlaneSemanticType>