# Pose

Class · category: Input

Source: https://github.com/playcanvas/engine/blob/970d89f6d3bc6667f4e1f88153abd6e7e82ed52c/src/extras/input/pose.js#L18

Represents a pose in 3D space, including position and rotation. It is what an
[InputController](https://api.playcanvas.com/engine/classes/InputController.md) produces: a [position](https://api.playcanvas.com/engine/classes/Pose.md#position), Euler [angles](https://api.playcanvas.com/engine/classes/Pose.md#angles) in degrees and, for
controllers that orbit, the [distance](https://api.playcanvas.com/engine/classes/Pose.md#distance) to the focus point. Optional ranges such as
[pitchRange](https://api.playcanvas.com/engine/classes/Pose.md#pitchrange) and [yRange](https://api.playcanvas.com/engine/classes/Pose.md#yrange) clamp the result of [rotate](https://api.playcanvas.com/engine/classes/Pose.md#rotate) and [move](https://api.playcanvas.com/engine/classes/Pose.md#move).

## Constructors

### constructor

```ts
new Pose(position?: Vec3, angles?: Vec3, distance?: number)
```

Creates a new Pose instance.

**Parameters**

- `position` ([`Vec3`](https://api.playcanvas.com/engine/classes/Vec3.md), optional, default `Vec3.ZERO`): The position of the pose.
- `angles` ([`Vec3`](https://api.playcanvas.com/engine/classes/Vec3.md), optional, default `Vec3.ZERO`): The angles of the pose in degrees.
- `distance` (`number`, optional, default `0`): The focus distance from the position to the pose.

## Properties

### angles

```ts
angles: Vec3
```

The angles of the pose in degrees calculated from the forward vector.

### distance

```ts
distance: number = 0
```

The focus distance from the position to the pose.

### pitchRange

```ts
pitchRange: Vec2
```

The allowed range of pitch angles in degrees, stored as (min, max). Applied when the pose
is rotated via [rotate](https://api.playcanvas.com/engine/classes/Pose.md#rotate).

### position

```ts
position: Vec3
```

The position of the pose.

### xRange

```ts
xRange: Vec2
```

The allowed range of positions along the x axis, stored as (min, max). Applied when the
pose is translated via [move](https://api.playcanvas.com/engine/classes/Pose.md#move).

### yawRange

```ts
yawRange: Vec2
```

The allowed range of yaw angles in degrees, stored as (min, max). Applied when the pose is
rotated via [rotate](https://api.playcanvas.com/engine/classes/Pose.md#rotate).

### yRange

```ts
yRange: Vec2
```

The allowed range of positions along the y axis, stored as (min, max). Applied when the
pose is translated via [move](https://api.playcanvas.com/engine/classes/Pose.md#move).

### zRange

```ts
zRange: Vec2
```

The allowed range of positions along the z axis, stored as (min, max). Applied when the
pose is translated via [move](https://api.playcanvas.com/engine/classes/Pose.md#move).

## Methods

### clone

```ts
clone(): Pose
```

Creates a clone of this pose.

**Returns** [`Pose`](https://api.playcanvas.com/engine/classes/Pose.md): A new Pose instance with the same position, angles, and distance.

### copy

```ts
copy(other: Pose): Pose
```

Copies the position and rotation from another pose.

**Parameters**

- `other` ([`Pose`](https://api.playcanvas.com/engine/classes/Pose.md)): The pose to copy from.

**Returns** [`Pose`](https://api.playcanvas.com/engine/classes/Pose.md): The updated Pose instance.

### equalsApprox

```ts
equalsApprox(other: Pose, epsilon?: number): boolean
```

Checks if this pose is approximately equal to another pose within a given epsilon.

**Parameters**

- `other` ([`Pose`](https://api.playcanvas.com/engine/classes/Pose.md)): The pose to compare with.
- `epsilon` (`number`, optional, default `1e-6`): The tolerance for comparison.

**Returns** `boolean`: True if the poses are approximately equal, false otherwise.

### getFocus

```ts
getFocus(out?: Vec3): Vec3
```

Gets the focus point of the pose, which is the position plus the forward vector scaled by the distance.

**Parameters**

- `out` ([`Vec3`](https://api.playcanvas.com/engine/classes/Vec3.md), optional): The output vector to store the focus point.

**Returns** [`Vec3`](https://api.playcanvas.com/engine/classes/Vec3.md): The focus point of the pose.

### lerp

```ts
lerp(lhs: Pose, rhs: Pose, alpha1: number, alpha2?: number, alpha3?: number): Pose
```

Lerps between two poses based on the given alpha values.

**Parameters**

- `lhs` ([`Pose`](https://api.playcanvas.com/engine/classes/Pose.md)): The left-hand side pose.
- `rhs` ([`Pose`](https://api.playcanvas.com/engine/classes/Pose.md)): The right-hand side pose.
- `alpha1` (`number`): The alpha value for position interpolation.
- `alpha2` (`number`, optional, default `alpha1`): The alpha value for angles interpolation.
- `alpha3` (`number`, optional, default `alpha1`): The alpha value for distance interpolation.

**Returns** [`Pose`](https://api.playcanvas.com/engine/classes/Pose.md): The updated Pose instance.

### look

```ts
look(from: Vec3, to: Vec3): Pose
```

Sets the pose to look in the direction of the given vector.

**Parameters**

- `from` ([`Vec3`](https://api.playcanvas.com/engine/classes/Vec3.md)): The point from which to look.
- `to` ([`Vec3`](https://api.playcanvas.com/engine/classes/Vec3.md)): The point to look at.

**Returns** [`Pose`](https://api.playcanvas.com/engine/classes/Pose.md): The updated Pose instance.

### move

```ts
move(offset: Vec3): Pose
```

Moves the pose by the given vector.

**Parameters**

- `offset` ([`Vec3`](https://api.playcanvas.com/engine/classes/Vec3.md)): The vector to move by.

**Returns** [`Pose`](https://api.playcanvas.com/engine/classes/Pose.md): The updated Pose instance.

### rotate

```ts
rotate(euler: Vec3): Pose
```

Rotates the pose by the given angles in degrees.

**Parameters**

- `euler` ([`Vec3`](https://api.playcanvas.com/engine/classes/Vec3.md)): The angles to rotate by.

**Returns** [`Pose`](https://api.playcanvas.com/engine/classes/Pose.md): The updated Pose instance.

### set

```ts
set(position: Vec3, angles: Vec3, distance: number): Pose
```

Sets the position and rotation of the pose.

**Parameters**

- `position` ([`Vec3`](https://api.playcanvas.com/engine/classes/Vec3.md)): The new position.
- `angles` ([`Vec3`](https://api.playcanvas.com/engine/classes/Vec3.md)): The new angles in degrees.
- `distance` (`number`): The new focus distance.

**Returns** [`Pose`](https://api.playcanvas.com/engine/classes/Pose.md): The updated Pose instance.
