<h2 id="rotatetolookatuser-updirection">rotateToLookAtUser</h2>

<div class='sourceset sourceset-android'>Android</div>

```kotlin
public fun SubspaceModifier.rotateToLookAtUser(
    upDirection: Vector3 = Vector3.Up
): SubspaceModifier
```

A [SubspaceModifier](/jetpack-compose/androidx.xr.compose/compose/interfaces/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](/jetpack-compose/androidx.xr.compose/compose/composable-functions/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](/jetpack-compose/androidx.xr.compose/compose/functions/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. |