rotateToLookAtUser
public fun SubspaceModifier.rotateToLookAtUser(
upDirection: Vector3 = Vector3.Up
): SubspaceModifier
A SubspaceModifier that continuously rotates content so that it faces the user at all times.
A user of this API should configure the activity's Session object with DeviceTrackingMode.LAST_KNOWN which requires android.permission.HEAD_TRACKING Android permission be granted by the calling application. session.configure( config = session.config.copy(headTracking = Config.HeadTrackingMode.LAST_KNOWN) )
This modifier might not work as expected when used on content within a androidx.xr.compose.spatial.FollowingSubspace.
The preceding rotate modifiers will be disregarded because this modifier will override them. But the rotate after the rotateToLookAtUser modifier will be respected.
To achieve a "billboard" effect—where the content rotates to face the user on the Y-axis while remaining upright and aligned with gravity—combine this with gravityAligned.
Parameters
| upDirection | Defines the reference "up" direction for the content's orientation. Pointing the content's forward vector at the user leaves the rotation around that axis (roll) undefined; this vector resolves that ambiguity. The default is Vector3.Up, which corresponds to the up direction of the ActivitySpace. |