# Standard Orientation of the World Coordinate System

Hi there,

I am new to this forum and would like to start with a question regarding the standard orientation of the world coordinate system.

For my project I am using mainly React Three Fiber and React Three Drei. Since, both of them base on ThreeJS I would like to start a discussion here.

In my project I visualize the surrounding’s of my RC Car with sensors attached to it. For example other surrounding objects are “recognized” in a different coordinate system (more a different orientation of it). This data will be send to my backend and then visualized in the Frontend.

Question: Is there a possibility to rotate R3F’s world coordinate system right from the get go to my desired orientation? This way I wouldn’t need to transform my objects beforehand.

The only (I would call them work arounds) I found are different camera position basically faking a rotation of the coordinate system. Or different standard orientations of the scene objects…

By default, three uses a Y-up coordinate system. Compared to Unreal for example, which uses a Z-up coordinate system.

You should be able to modify the ‘up’ of the camera (which is a vector3) to whatever you desire. The only thing that may “break” are some controllers that assume a Y-up system.

Over all I would like to reduce coordinate transformations to a minimum. In my opinion I could achieve this by turning the world coordinate system at the beginning. Not only the “up” direction of it.

In my case all my surrounding objects “look” in X+ (Z+ === up; Y+ === right).

Only manipulating the camera position is simply not enough. I would need to define the CS’s axis.

You can rotate a root object so the axes are in the desired orientation:

``````const scene = new Scene();
const root = new Group();
root.rotation.x = - Math.PI / 2;
``````
1 Like

that will only swap y and z - freaksigner then wants to swap y and x.

true, could OP apply a matrix with the correct transforms to the group? eg.

``````const root = new Group();
const XZYMatrix = new THREE.Matrix4().set(
1, 0, 0, 0,
0, 0, 1, 0,
0, 1, 0, 0,
0, 0, 0, 1
);
root.applyMatrix4(XZYMatrix);
``````

no expert on matrices so this may be incorrect…

1 Like

still maps x to x, no?

@makc3d Ah yeah just tested, I had it set to the polar opposite, the correct matrix values would be…

``````0, 1, 0, 0,
0, 0, 1, 0,
1, 0, 0, 0,
0, 0, 0, 1
``````

Where X is forwards Z is up and Y is right.

@FReaksinger you could then simply add your XZY oriented objects to this group without having to worry about anything else in theory…

Thank you guys for your answers! @gkjohnson @Lawrence3DPK @makc3d . This is excatly what I needed!