Modify default coordinate system to engineering style (Z axis UP)

Hello,
I would like to use Threejs in a project related to engineering CAD. Most engineering 3D softwares (if not all) uses a right hand coordinate system where Z+ represent the UP direction in the real world, leaving the XY plane representing the ground. This is also the common definition of the axes in the mathematics world. While I understand that in the 3D animation and modelling world, the coordinates system is defined as a right hand style but with Z+ going into the viewer, this is really not practical in a engineering point of view.

I was wondering if there is a way to configure globally Threejs to modify the UP direction with Z+? By globally, I mean not having to use THREE.Object3D.DefaultUp = new THREE.Vector3(0,0,1); in every scene and that helpers (such as the grid), respect this configuration without having to rotate it manually.

I have seen some post and answers, but they seems to only address the coordinate system of the camera or for a single scene. Here, here, here and here (although this last one is using left hand rule).

Here some more links to Wikipedia pages
Coordinate sytem
Three dimensions cartesian coordinate system

It’s not as clear-cut as you claim.

This topic has come up here several times before, but oddly, although the forum search does turn up the respective thread titles, they can’t be accessed. Not even on archive.org.

See this:

2 Likes

Place your CAD scene under an empty Object3D with
object.rotation.x = -Math.PI*.5;
Use .localToWorld and .worldToLocal to transform coordinates from model space to worldspace and back.

You can go through heroic efforts to force the engine into a sort of crippled Z up/left handed/whatever mode, but then you quickly realize you’re fighting against the entire ecosystem. You have not experienced true joy until you’ve tried to rotate equirectangular environment maps to work with Z up.
If you do manage to get a zombie Z-up left handed thing working, look forward to repairing it endlessly as new releases undo the layers of fixes you’ve had to apply to various cross sections of the library.

1 Like

Wow! Ok, this is a real far west in the creative sphere of 3D modeling :exploding_head:. But I can assure you that for engineering this is clear cut. In fact, it is even defined in ISO standards (at least ISO 80000-2 and ISO 8855). All CAD software I used is using Z-up right handed (CATIA, FreeCAD, Inventor, SolidEdge, SolidWorks).

I’ve seen a single product in CAD that was not using this standard (a mistake made by the guy that first created the file, even if the software was using Z-up right handed :sweat_smile:) and it was a nightmare (less now with a tons of macros and manual patching).

Thanks for the warning if I go the route of “patching” it. I’ll see what can be done playing with the models.

My main concerns come when using helpers. They (obviously) use the Y-up, right handed coordinate system, making my frontend showing the wrong labels. So I was thinking about trying to find a way to simply change the visual frontend label, while keeping the backend as-is. But this would be a big mind-bending mess to keep this in mind at all times.

You’ve signed the waiver! :smiley: Have fun!