How to use the rotation matrix correctly?

Thank you for the reference and the quick response!
Investigating deeper in that direction (and with the help of a mathematician friend) I have discovered that the vectors I have form the 4x4 direction matrix, which is the inverse matrix of the 4x4 rotation matrix. A call to Matrix4.getInverse was the solution to define rotations using direction vectors.

const x = transform[xAxis];
const y = transform[yAxis];
const z = transform[zAxis];
const directionMatrix = new THREE.Matrix4();
const rotationMatrix = new THREE.Matrix4();
directionMatrix.set( 
 x[0] ,x[1] ,x[2] ,0
,y[0] ,y[1] ,y[2] ,0
,z[0] ,z[1] ,z[2] ,0
,0    ,0    ,0    ,1
);
rotationMatrix.getInverse(directionMatrix);
return rotationMatrix;
1 Like