Hello everyone.

After days of research, the rotation matrices are not behaving like I expect, and I don’t know what I am missing. I need to define the rotation of each object in my scene in the form of three direction unit vectors, each one describing the direction of one local axis. Following this thread, I have created a simple scene with two axes. I am applying rotations to the second one, while the first one (in the center) shows the global coordinates.

In my case, the default direction vectors for an object are the following. These values mean that there is no rotation applied on the object.

```
Axis x: (1,0,0)
Axis y: (0,1,0)
Axis z: (0,0,1)
```

Following this criteria, I have tried to rotate the object 90º on the Y axis counter clockwise (so that the Z axis ends up pointing in the direction of the current x Axis):

```
const rotationMatrix = new THREE.Matrix4();
rotationMatrix.set(
0 ,0 ,-1 ,0
,0 ,1 ,0 ,0
,1 ,0 ,0 ,0
,0 ,0 ,0 ,1
);
axes.rotation.setFromRotationMatrix(rotationMatrix);
```

The first issue that I have encountered is that the rotation is not made in the direction I expected; in this case, it is made clockwise instead of counter clockwise.

I can fix this inverting the local rotation after applying the rotation matrix:

```
axes.rotation.x *= -1;
axes.rotation.y *= -1;
axes.rotation.z *= -1;
```

So far, so good, and this works for rotations in all the axes. Nonetheless, there might be objects that have rotations in multiple axes. For example, I want to rotate this object not only 90º on the Y axis, but also 90º on the (global) Z axis. The result that I expect is an object that has the the local X pointing to the global -Z, the local Y pointing to the global X and the local Z pointing to the global -Y.

```
const rotationMatrix = new THREE.Matrix4();
rotationMatrix.set(
0 ,0 ,-1 ,0
,1 ,0 ,0 ,0
,0 ,-1 ,0 ,0
,0 ,0 ,0 ,1
);
axes.rotation.setFromRotationMatrix(rotationMatrix);
axes.rotation.x *= -1;
axes.rotation.y *= -1;
axes.rotation.z *= -1;
```

But this is what I get:

Is there something I missed about the rotation matrix?

Thank you in advance!