Skip to content
party.js logoparty.js logo

ReferenceSamplersFunction

randomOrientation()

Picks a random rotation.

see Shoemake, K. (1992). “III.6 - Uniform Random Rotations.”

function randomOrientation(axis?: Readonly<Vec3>): SamplerFn<Quat>;

Creates a sampler for random rotations. If no axis is provided then each orientation is equally likely, otherwise the rotation is only created around the given axis.

For example, rotations around +z keep flat shapes facing the viewer, only turning them within the screen plane.

axisoptionalReadonly<Vec3>

Optionally, the axis to create the rotation around.