TruWorlds

CMatrix

A 4x3 matrix used for 3D transformations, including position and rotation.

Properties

Row0 Vector3

The first row of the matrix.

Row1 Vector3

The second row of the matrix.

Row2 Vector3

The third row of the matrix.

Row3 Vector3

The fourth row of the matrix, representing the position.

Position Vector3

The position component of the matrix.

Rotation Quaternion

The rotation component of the matrix as a quaternion.

Forward Vector3 read-only

The forward direction vector of the matrix.

Up Vector3 read-only

The up direction vector of the matrix.

Right Vector3 read-only

The right direction vector of the matrix.

Functions

LookingAt(target: Vector3, up: Vector3) Returns CMatrix

Creates a look-at matrix from this CMatrix's origin that orients an object to face a target point with a specified up direction.

target
The target point to look at.
up
The up direction vector.

Returns: A CMatrix representing the look-at transformation.

Lerp(a: CMatrix, b: CMatrix, t: float) Returns CMatrix

Linearly interpolates the position component and spherically interpolates the rotation component between two CMatrix instances.

a
The starting matrix.
b
The ending matrix.
t
The interpolation factor (0.0 to 1.0).

Returns: The interpolated CMatrix.

Multiply(other: CMatrix) Returns CMatrix

Multiplies this CMatrix by another CMatrix, combining their transformations.

other
The other matrix representing the transformation to apply.

Returns: >The resulting matrix after multiplication.

Inverse() Returns CMatrix

Computes the inverse of the matrix, which reverses the transformation it represents.

Returns: >The inverse of the matrix.

XForm(point: Vector3) Returns Vector3

Transforms a point by this matrix.

point
The point to transform.

Returns: The transformed point.

XFormInv(point: Vector3) Returns Vector3

Inverse transforms a point by this matrix.

point
The point to inverse transform.

Returns: The inverse transformed point.