Rotating WorldPosition by actor rotation

I’m trying to adjust “absolute world position” so its center and orientation is of an actor. Centering works fine but I just can get a usable rotation. This thread has some kind of a solution using the matrix 3x3 transform material function. I’m feeding it the actor’s forward, right and up vectors but the result is that the new coordinate system rotates the opposite way when the actor is rotated: if I rotate the actor +45 degrees around up axis for example then the coordinates system in the material rotates -45. (I’m checking it by displaying the coordinates as color.)

The thread above notes that swapping around axes (like X and Y in the attached image there) might be necessary so I did that but after trying out all the permutations I did not find one where everything worked properly: at least one of the axes rotated backwards. Multiplying an axis by -1 might fix one rotation direction but break an other.

The solution is multiplying the incoming forward, right and up vectors by (-1,1,1), (1,-1,1) and (1,1,-1) respectively.

Actually it’s just a half solution: rotating around a single axis is fine but it all gets messed up when the rotation is more complex.

Here is an animation showing the problem:

http://zspline.net/temp/CoordinateSystemRotationIssue.gif

Coordinates are shown as colors. So from (0,0,0) rotation first the mesh rotates 90 degrees around world up axis. The transformed coordinate system follows. Then comes the 90 degree rotation around local right axis which modifies the coordinates on world right axis. Also note how the green and blue quadrants shrink as their dividing planes rotate toward each other.

This is the node network I’m using:

http://zspline.net/temp/Clipboard%20Image%20(45).png

The following material function rotates a vector (in my case world position) by an Euler rotation:

http://zspline.net/temp/Clipboard%20Image%20(46).png