SpatialModeChangeListener


public fun interface SpatialModeChangeListener


The SpatialModeChangeListener is used to handle scenegraph updates when the spatial mode for the scene changes.

Summary

Public methods

abstract void
onSpatialModeChanged(
    @NonNull Pose recommendedPose,
    float recommendedScale
)

Callback that provides a new recommended pose and scale for placing content.

Public methods

onSpatialModeChanged

Added in 1.0.0-alpha05
abstract void onSpatialModeChanged(
    @NonNull Pose recommendedPose,
    float recommendedScale
)

Callback that provides a new recommended pose and scale for placing content.

This is called whenever the activity encounters a spatial mode change or re-center. The most common app behavior is to set the pose and scale of an entity relative to the ActivitySpace origin. The default behavior is equivalent to:

Scene.keyEntity.setPose(recommendedPose, relativeTo = Space.ACTIVITY);
Scene.keyEntity.setScale(recommendedScale, relativeTo = Space.ACTIVITY);
Parameters
@NonNull Pose recommendedPose

the recommended pose for the keyEntity. The pose is relative to ActivitySpace origin, not relative to the keyEntity's parent.

float recommendedScale

the recommended scale for the keyEntity. The scale value is the accumulated scale for this entity i.e. accumulated scale in ActivitySpace, not relative to the keyEntity's parent.