@novorender/api / rotationFromDirection
Function: rotationFromDirection()
function rotationFromDirection(dir, snapToAxis?): quat;
Defined in: @novorender/src/web_app/controller/orientation.ts:188
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
Parameter | Type | Description |
---|---|---|
dir | ReadonlyVec3 | Direction vector. |
snapToAxis? | quat | Snap to custom rotation, uses Y as up otherwise |
Returns
quat
Rotation computed for the given direction and snap axis.