Companion

object Companion

Properties

Link copied to clipboard

No rotation. The default for every scene composable's rotation argument.

Functions

Link copied to clipboard
fun axisAngle(axis: Direction, degrees: Float): Rotation

degrees of rotation about axis (normalized for you), right-hand rule. A zero-length axis names no rotation, so Identity comes back rather than a NaN that would silently hide the entity.

Link copied to clipboard
fun euler(pitch: Float = 0.0f, yaw: Float = 0.0f, roll: Float = 0.0f): Rotation

From intrinsic Tait-Bryan angles in degrees, applied Z (roll) then Y (yaw) then X (pitch) — filament-utils' default RotationsOrder.ZYX.

Link copied to clipboard

The shortest-arc rotation taking from onto to. Length is irrelevant — only the two directions are — so displacements like target - muzzle can be passed straight in.

Link copied to clipboard
fun lookTowards(forward: Direction, up: Direction = Direction.Up): Rotation

Aims an entity along forward: the rotation that takes local −Z (the glTF/Filament "forward" axis) onto forward, keeping local +Y as close to up as it can. This is the turret / billboard / chase-camera building block.

Link copied to clipboard

Normalized linear interpolation — cheaper than slerp but not constant-rate. Fine for per-frame blending between nearby orientations. Takes the short way round, as slerp does.

Link copied to clipboard

Shortest-path spherical interpolation: t = 0 gives a, t = 1 gives b, and the path between them turns at a constant rate. The one to reach for when blending poses.