Skip to content

createTransform#worldRotation

Summary

createTransform#worldRotation gives a fresh snapshot of the transform's world-space orientation as an [x, y, z, w] quaternion. Parent rotations are included, and parent scales do not affect the result.

Syntax

readonly Transform.worldRotation: number[]
const orientation = transform.worldRotation;

Returns

number[] - A new normalized quaternion. Use getWorldRotation with a destination array for repeated reads.

Example

const parent = wgpu.createTransform().setRotationFromEuler(0, Math.PI / 2, 0);
const child = wgpu.createTransform().setParent(parent);
console.log(child.worldRotation);
child.dispose();
parent.dispose();

See Also