# BaseScenePose

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.BaseScenePose) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

*** ** * ** ***


```
public abstract class BaseScenePose<RtScenePoseType extends androidx.xr.scenecore.runtime.ScenePose> implements ScenePose
```

<br />

Known direct subclasses [Entity](https://developer.android.com/reference/androidx/xr/scenecore/Entity), [PerceptionSpace](https://developer.android.com/reference/androidx/xr/scenecore/PerceptionSpace)

|---|---|
| `https://developer.android.com/reference/androidx/xr/scenecore/Entity` | An Entity is the fundamental building block of a SceneCore `https://developer.android.com/reference/androidx/xr/scenecore/Scene`. |
| `https://developer.android.com/reference/androidx/xr/scenecore/PerceptionSpace` | PerceptionSpace is an `https://developer.android.com/reference/androidx/xr/scenecore/ScenePose` used to track the origin of the space used by ARCore for Jetpack XR APIs. |

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

|---|---|
| `https://developer.android.com/reference/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/androidx/xr/scenecore/ActivitySpace` | ActivitySpace is a `https://developer.android.com/reference/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/androidx/xr/scenecore/AnchorSpace` | An AnchorSpace is a `https://developer.android.com/reference/androidx/xr/scenecore/SpaceEntity` tracks a `https://developer.android.com/reference/androidx/xr/runtime/math/Pose` relative to some position or surface in the "Real World." Children of this `https://developer.android.com/reference/androidx/xr/scenecore/SpaceEntity` will remain positioned relative to that location in the real world. |
| `https://developer.android.com/reference/androidx/xr/scenecore/GltfModelEntity` | GltfModelEntity is a concrete implementation of Entity that hosts a glTF model. |
| `https://developer.android.com/reference/androidx/xr/scenecore/MainPanelEntity` | Represents the main spatialized panel in a `https://developer.android.com/reference/androidx/xr/scenecore/Scene`. |
| `https://developer.android.com/reference/androidx/xr/scenecore/MeshEntity` | A renderable entity in the scene graph that renders a `https://developer.android.com/reference/androidx/xr/scenecore/CustomMesh`. |
| `https://developer.android.com/reference/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/androidx/xr/scenecore/SpaceEntity` | A SpaceEntity is a special Entity subtype whose position is independent of other SpaceEntity. |
| `https://developer.android.com/reference/androidx/xr/scenecore/SurfaceEntity` | SurfaceEntity is an `https://developer.android.com/reference/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/androidx/xr/scenecore/SurfaceEntity.Shape`. |

*** ** * ** ***

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

## Summary

| ### Protected constructors |
|---|
| `<RtScenePoseType extends androidx.xr.scenecore.runtime.ScenePose> https://developer.android.com/reference/androidx/xr/scenecore/BaseScenePose#BaseScenePose(androidx.xr.scenecore.runtime.ScenePose)( @https://developer.android.com/reference/androidx/annotation/NonNull RtScenePoseType rtScenePose )` |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Pose` | `https://developer.android.com/reference/androidx/xr/scenecore/BaseScenePose#getPoseInActivitySpace()()` The current `https://developer.android.com/reference/androidx/xr/runtime/math/Pose` relative to the activity space root. |
| `https://developer.android.com/reference/androidx/xr/scenecore/HitTestResult` | `https://developer.android.com/reference/androidx/xr/scenecore/BaseScenePose#hitTest(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 origin, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 direction)` Perform a hit test from the specified origin in the specified direction into the Scene. |
| `https://developer.android.com/reference/androidx/xr/scenecore/HitTestResult` | `https://developer.android.com/reference/androidx/xr/scenecore/BaseScenePose#hitTest(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3,kotlin.Int)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 origin, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 direction, int hitTestFilter )` Creates a hit test from the specified origin in the specified direction into the scene. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/androidx/xr/scenecore/BaseScenePose#transformDirectionTo(androidx.xr.runtime.math.Vector3,androidx.xr.scenecore.ScenePose)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 direction, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/ScenePose destination )` Transforms a direction from this ScenePose's local space to the destination ScenePose's local space. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Pose` | `https://developer.android.com/reference/androidx/xr/scenecore/BaseScenePose#transformPoseTo(androidx.xr.runtime.math.Pose,androidx.xr.scenecore.ScenePose)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Pose pose, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/ScenePose destination)` Returns a `https://developer.android.com/reference/androidx/xr/runtime/math/Pose` relative to this ScenePose, transformed into a Pose relative to the destination. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/androidx/xr/scenecore/BaseScenePose#transformPositionTo(androidx.xr.runtime.math.Vector3,androidx.xr.scenecore.ScenePose)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 position, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/ScenePose destination )` Transforms a position from this ScenePose's local space to the destination ScenePose's local space. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/androidx/xr/scenecore/BaseScenePose#transformVectorTo(androidx.xr.runtime.math.Vector3,androidx.xr.scenecore.ScenePose)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 vector, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/ScenePose destination)` Transforms a vector from this ScenePose's local space to the destination ScenePose's local space. |

## Protected constructors

### BaseScenePose

```
protected <RtScenePoseType extends androidx.xr.scenecore.runtime.ScenePose> BaseScenePose(
    @NonNull RtScenePoseType rtScenePose
)
```

## Public methods

### getPoseInActivitySpace

```
public @NonNull Pose getPoseInActivitySpace()
```

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

### hitTest

```
public HitTestResult hitTest(@NonNull Vector3 origin, @NonNull Vector3 direction)
```

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

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

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/xr/scenecore/HitTestResult` | The `https://developer.android.com/reference/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

```
public HitTestResult hitTest(
    @NonNull Vector3 origin,
    @NonNull Vector3 direction,
    int hitTestFilter
)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 origin` | The translation of the origin of the hit test relative to this ScenePose. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 direction` | The direction for the hit test ray from the origin |
| `int hitTestFilter` | 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/androidx/xr/scenecore/HitTestResult` | The `https://developer.android.com/reference/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

```
public @NonNull Vector3 transformDirectionTo(
    @NonNull Vector3 direction,
    @NonNull ScenePose destination
)
```

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/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 direction` | The direction in this ScenePose's local coordinate space |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/ScenePose destination` | The ScenePose which the returned direction will be relative to. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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

```
public @NonNull Pose transformPoseTo(@NonNull Pose pose, @NonNull ScenePose destination)
```

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

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

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

### transformPositionTo

```
public @NonNull Vector3 transformPositionTo(
    @NonNull Vector3 position,
    @NonNull ScenePose destination
)
```

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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 position` | The position in this ScenePose's local coordinate space |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/ScenePose destination` | The ScenePose which the returned position will be relative to. |

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

### transformVectorTo

```
public @NonNull Vector3 transformVectorTo(@NonNull Vector3 vector, @NonNull ScenePose destination)
```

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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 vector` | The vector in this ScenePose's local coordinate space |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/ScenePose destination` | The ScenePose which the returned vector will be relative to. |

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