# Mirroring - yet another rotation question

Please take a moment to consider if this thread is worth bumping.

## Recommended Posts

I know I will chew off my lips when I see the solution, but I'm stuck here.

I want to mirror a prim at an axis - let's say the global x-achis. I got the positioning right - piece of cake. But I just don't get the rotation math right.

How do I get the rotation mirrored properly (let's keep it simple, and take the global x-axis?

##### Share on other sites

The matter isn't simple but it doesn't take much code to do:

`vector mirrorNormal = llRot2Fwd( llGetRot() ); // mirror normal is the mirror's forward(red) directionvector objNormal = llRot2Fwd( objRot ); // object normal is the Prim's forward(red) directionrotation mirrorRot = llRotBetween( objNormal, mirrorNormal );  // rotation from objects YZ plane to mirror planerotation newRotation = objRot*mirrorRot*mirrorRot;`

I will not elaborate why it is like that, but try it

llRot2Fwd() is using the X-axis but the code works for any position, not just the global X-axis

:smileysurprised::smileyvery-happy:

Edit: typo in code

##### Share on other sites

Thanks a lot, Dora - I will try it - and try to understand it.

##### Share on other sites

I have two more questions:

1. What is objRot?
2. What is normal (third line in your code)?

Thanks!

##### Share on other sites

1. objRot is the object's or the prim's rotation
2. There was a typo in thet line, normal should be mirrorNormal
##### Share on other sites

Ok. Which object/prim these lines a written for? My starting point id the original object - so objRot would be llGetRot()

##### Share on other sites

You figure that out. This piece of code goes in the mirror and not the prim to be rotated.
The mirror is the prim that describes the mirror plane with it's YZ plane and thus the mirror normal is the prim's X-axis