Skip to main content

@novorender/web_app / rotationFromDirection

Function: rotationFromDirection()

function rotationFromDirection(dir, snapToAxis?): quat

Retuns a quaternion computed for the given direction. Will compute rotation with Y as the up vector unless direction is Y or snapToAxis is given

Parameters

ParameterTypeDescription
dirReadonlyVec3Direction vector.
snapToAxis?quatSnap to custom rotation, uses Y as up otherwise

Returns

quat

Rotation computed for the given direction and snap axis.

Defined in

@novorender/web_app/controller/orientation.ts:183