# ScenePose

Artifact: [androidx.xr.scenecore:scenecore](https://developer.android.com/jetpack/androidx/releases/xr-scenecore) [View Source](https://cs.android.com/search?q=file:androidx/xr/scenecore/ScenePose.kt+class:androidx.xr.scenecore.ScenePose) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

*** ** * ** ***


```
interface ScenePose
```

<br />

Known direct subclasses [BaseScenePose](https://developer.android.com/reference/kotlin/androidx/xr/scenecore/BaseScenePose)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/BaseScenePose` | The BaseScenePose implements the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose` interface. |

Known indirect subclasses [ActivityPanelEntity](https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ActivityPanelEntity), [ActivitySpace](https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ActivitySpace), [AnchorSpace](https://developer.android.com/reference/kotlin/androidx/xr/scenecore/AnchorSpace), [Entity](https://developer.android.com/reference/kotlin/androidx/xr/scenecore/Entity), [GltfModelEntity](https://developer.android.com/reference/kotlin/androidx/xr/scenecore/GltfModelEntity), [MainPanelEntity](https://developer.android.com/reference/kotlin/androidx/xr/scenecore/MainPanelEntity), [MeshEntity](https://developer.android.com/reference/kotlin/androidx/xr/scenecore/MeshEntity), [PanelEntity](https://developer.android.com/reference/kotlin/androidx/xr/scenecore/PanelEntity), [PerceptionSpace](https://developer.android.com/reference/kotlin/androidx/xr/scenecore/PerceptionSpace), [SpaceEntity](https://developer.android.com/reference/kotlin/androidx/xr/scenecore/SpaceEntity), [SurfaceEntity](https://developer.android.com/reference/kotlin/androidx/xr/scenecore/SurfaceEntity)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ActivityPanelEntity` | ActivityPanelEntity creates a spatial panel for embedding an `https://developer.android.com/reference/android/app/Activity.html` in Android XR. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ActivitySpace` | ActivitySpace is a `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/SpaceEntity` used to track the system-managed pose and boundary of the volume associated with a spatialized Activity. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/AnchorSpace` | An AnchorSpace is a `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/SpaceEntity` tracks a `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` relative to some position or surface in the "Real World." Children of this `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/SpaceEntity` will remain positioned relative to that location in the real world. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/Entity` | An Entity is the fundamental building block of a SceneCore `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/Scene`. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/GltfModelEntity` | GltfModelEntity is a concrete implementation of Entity that hosts a glTF model. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/MainPanelEntity` | Represents the main spatialized panel in a `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/Scene`. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/MeshEntity` | A renderable entity in the scene graph that renders a `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/CustomMesh`. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/PanelEntity` | PanelEntity contains an arbitrary 2D Android `https://developer.android.com/reference/android/view/View.html`, within a spatialized XR scene. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/PerceptionSpace` | PerceptionSpace is an `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose` used to track the origin of the space used by ARCore for Jetpack XR APIs. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/SpaceEntity` | A SpaceEntity is a special Entity subtype whose position is independent of other SpaceEntity. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/SurfaceEntity` | SurfaceEntity is an `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/Entity` that hosts a `https://developer.android.com/reference/android/view/Surface.html`, which will be texture mapped onto the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/SurfaceEntity.Shape`. |

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` in the Scene graph, which can be transformed into a Pose relative to another ScenePose.

## Summary

| ### Nested types |
|---|
| `object https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose.HitTestFilter` A filter for which Scenes to hit test with `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose#hitTest(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3)`. |

| ### Public functions |
|---|---|
| `suspend https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult?` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose#hitTest(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3)(origin: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3, direction: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3)` Perform a hit test from the specified origin in the specified direction into the Scene. |
| `suspend https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult?` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose#hitTest(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3,kotlin.Int)(origin: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3, direction: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3, hitTestFilter: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates a hit test from the specified origin in the specified direction into the scene. |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose#transformDirectionTo(androidx.xr.runtime.math.Vector3,androidx.xr.scenecore.ScenePose)(direction: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3, destination: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose)` Transforms a direction from this ScenePose's local space to the destination ScenePose's local space. |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose#transformPoseTo(androidx.xr.runtime.math.Pose,androidx.xr.scenecore.ScenePose)(pose: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose, destination: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose)` Returns a `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` relative to this ScenePose, transformed into a Pose relative to the destination. |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose#transformPositionTo(androidx.xr.runtime.math.Vector3,androidx.xr.scenecore.ScenePose)(position: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3, destination: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose)` Transforms a position from this ScenePose's local space to the destination ScenePose's local space. |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose#transformVectorTo(androidx.xr.runtime.math.Vector3,androidx.xr.scenecore.ScenePose)(vector: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3, destination: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose)` Transforms a vector from this ScenePose's local space to the destination ScenePose's local space. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose#poseInActivitySpace()` The current `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` relative to the activity space root. |

## Public functions

### hitTest

```
suspend fun hitTest(origin: Vector3, direction: Vector3): HitTestResult?
```

Perform a hit test from the specified origin in the specified direction into the Scene.

| Parameters |
|---|---|
| `origin: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | The translation of the origin of the hit test relative to this ScenePose. |
| `direction: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | The direction for the hit test ray from the origin. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult?` | The `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult`, or null if the hit test did not find an intersection. The HitTestResult describes the location and normal of the object closest to the hit, relative to this ScenePose. |

### hitTest

```
suspend fun hitTest(origin: Vector3, direction: Vector3, hitTestFilter: Int): HitTestResult?
```

Creates a hit test from the specified origin in the specified direction into the scene.

| Parameters |
|---|---|
| `origin: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | The translation of the origin of the hit test relative to this ScenePose. |
| `direction: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | The direction for the hit test ray from the origin |
| `hitTestFilter: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Filter for which scenes to hit test. Hitting other scenes is only allowed for apps with the `com.android.extensions.xr.ACCESS_XR_OVERLAY_SPACE` permission. Value is either `0` or a combination of the following: - `1` - `2` <br /> |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult?` | The `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult`, or null if the hit test did not find an intersection. The HitTestResult describes the location and normal of the object closest to the hit, relative to this ScenePose. |

### transformDirectionTo

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
fun transformDirectionTo(direction: Vector3, destination: ScenePose): Vector3
```

Transforms a direction from this ScenePose's local space to the destination ScenePose's local space. This operation ignores relative scaling; the output vector will have the same magnitude as `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose#transformDirectionTo(androidx.xr.runtime.math.Vector3,androidx.xr.scenecore.ScenePose)`.

This operation is not affected by either ScenePose's scale or position.

| Parameters |
|---|---|
| `direction: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | The direction in this ScenePose's local coordinate space |
| `destination: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose` | The ScenePose which the returned direction will be relative to. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | The direction in the destination ScenePose's local space. It will have the same magnitude as the input direction. |

### transformPoseTo

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
fun transformPoseTo(pose: Pose, destination: ScenePose): Pose
```

Returns a `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` relative to this ScenePose, transformed into a Pose relative to the destination.

| Parameters |
|---|---|
| `pose: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` | A Pose in this ScenePose's local coordinate space. |
| `destination: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose` | The ScenePose which the returned Pose will be relative to. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` | The Pose relative to the destination ScenePose. |

### transformPositionTo

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
fun transformPositionTo(position: Vector3, destination: ScenePose): Vector3
```

Transforms a position from this ScenePose's local space to the destination ScenePose's local space.

This operation is affected by both ScenePose's position, rotation, and scale.

| Parameters |
|---|---|
| `position: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | The position in this ScenePose's local coordinate space |
| `destination: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose` | The ScenePose which the returned position will be relative to. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | The position in the destination ScenePose's local space. |

### transformVectorTo

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
fun transformVectorTo(vector: Vector3, destination: ScenePose): Vector3
```

Transforms a vector from this ScenePose's local space to the destination ScenePose's local space. This operation accounts for scale. The magnitude of the output vector might be different from the magnitude of the input vector.

This operation is not affected by either ScenePose's position.

| Parameters |
|---|---|
| `vector: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | The vector in this ScenePose's local coordinate space |
| `destination: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose` | The ScenePose which the returned vector will be relative to. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | The vector in the destination ScenePose's local space. The returned magnitude will be affected by destination scale. |

## Public properties

### poseInActivitySpace

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
val poseInActivitySpace: Pose
```

The current `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` relative to the activity space root.