bbi.transform

class Transform(position: Vector3 = Vector3.zero(), rotation: Vector3 = Vector3.zero(), scale: Vector3 = Vector3(1, 1, 1))

Bases: object

A transform in 3D space that represents position, rotation, and scale.

By convention, units for world space are in meters.

Parameters:
  • position (Vector3, optional) – The position. Defaults to Vector3.zero().

  • rotation (Vector3, optional) – The rotation. Defaults to Vector3.zero().

  • scale (Vector3, optional) – The scale. Defaults to Vector3(1, 1, 1).

right_to_left_handed_conversion = array([[ 0,  1,  0,  0],        [ 1,  0,  0,  0],        [ 0,  0, -1,  0],        [ 0,  0,  0,  1]])
property position: Vector3
property rotation: Vector3
property scale: Vector3
property matrix: ndarray
apply_relative_transform(relative_transform: Transform) Transform

Applies the relative transform to this transform.

Parameters:

relative_transform (Transform) – The relative transform.

Returns:

The transformed transform.

Return type:

Transform

transform_position(position: Vector3) Vector3

Transforms a position vector by this transform accounting its scale.

Parameters:

position (Vector3) – The position to transform.

Returns:

The transformed position.

Return type:

Vector3

transform_rotation(relative_rotation: Vector3) Vector3

Transforms a rotation vector by this transform.

Parameters:

relative_rotation (Vector3) – The rotation to transform.

Returns:

The transformed rotation.

Return type:

Vector3

transform_scale(relative_scale: Vector3) Vector3

Transforms a scale vector by this transform.

Parameters:

relative_scale (Vector3) – The scale to transform.

Returns:

The transformed scale.

Return type:

Vector3

relative_to(reference: Transform) Transform

Calculates the transform of this transform relative to another transform.

Parameters:

reference (Transform) – The reference transform against which the relative transformation is calculated.

Returns:

A new Transform object representing this transform relative to reference,

with calculated position, rotation, and scale.

Return type:

Transform

get_relative_position(other_position: Vector3) Vector3

Calculates the relative position of other position relative to this transform.

Parameters:

other_position (Vector3) – The other position.

Returns:

The relative position.

Return type:

Vector3

get_relative_rotation(other_rotation: Vector3) Vector3

Calculates the relative rotation of other rotation relative to this transform.

Parameters:

other_rotation (Vector3) – The other rotation.

Returns:

The relative rotation.

Return type:

Vector3

get_relative_scale(other_scale: Vector3) Vector3

Calculates the relative scale of other scale relative to this transform.

Parameters:

other_scale (Vector3) – The other scale.

Returns:

The relative scale.

Return type:

Vector3