Skip to main content

function.rotationFromDirection

API > rotationFromDirection

Function: rotationFromDirection

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.

Source

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