# Torque orientation when changing the coordinate system

I have some Unity application, where the user can input a torque that will be apply to a given rigidbody. Nonetheless, the sophistication comes from the fact that the input from the user is in a given coordinate system ((x,y,z) becomes (y,-z,x) in unity) which follow the right-hand rule and that it'll be converted to the unity coordinate system which unfortunately follow the left-hand rule...

Let's summarize, the user input his torque in his coordinate system which will be converted to the coordinate system of unity and finally the torque is apply using AddTorque.

The problem is that when for example the user enter a torque of (0,0,-1000) it'll assume that the rigidbody will turn on his left, but as unity coordinate system use left hand rule the rigidbody will turn on his right.

How can I convert the torque from one system to the other but I want to keep the orientation of the torque ? Or in an equivalent way : How can I make sure that the user does not know that there has been a change of coordinate system and that everything is transparent for him ?

Sorry if it's a bit confusing, please let met know if you need some further details.

Edit : I made a typing error, I wanted to write (0,0,1000) for the torque example. To match with the answer, I will just reverse the direction in which it turns.

## 1 Answer

When you change handedness, all angles are negated. So all you have to do is negate the torque.

If I'm reading your question correctly, your source coordinate system is:

• x+ forward
• y+ right
• z+ down

In that coordinate system, a torque of (0, 0, -1000) should rotate left (counter-clockwise if we're looking down on the plane of rotation). To see this, point your right thumb upward (away from z+ "down" because our torque has a negative z component). Your fingers curl to the left, in the direction of rotation.

Converting this to Unity's coordinates using the swizzle you provided (y, -z, x) gives (0, 1000, 0), which rotates right (clockwise when looking down on the plane of rotation). (This time we point our left thumb upward, toward y+ since the torque has a positive y component, and our fingers curl to the right).

So all you have to do to get back to leftward rotation is negate it to produce (0, -1000, 0).

Distributing the negation through your swizzle gives you (-y, z, -x).