Skip to content

format

typescript
Quaternion.RotateVector(src)

class: Quaternion

description

Calculates the vector after rotating the target vector by the current quaternion.

Equivalent to multiplying the quaternion by the vector.

parameter

param_nametypedescription
srcVector3The target vector.

reture

typedescription
Vector3The new vector after rotation.

code example

typescript
function QuaternionTest (){
    let x = new Vector3(1,0,0);
    let quat_axis = Quaternion.AngleAxis(60,new Vector3(0,1,0));
    let rx = quat_axis.RotateVector(x);
    let ix = quat_axis.InvertRotateVector(rx);
}