This is the second article of a series about coordinate systems comparison between Autodesk 3ds Max, Unity 3D and Unreal Engine. In this article I will look at world coordinate systems. Here’s the complete list of articles in the series:
3ds Max World Coordinate System
3ds Max uses a right handed, z-up world coordinate system. Below you can see a test scene with the standard teapot and a textured quad (pivot shown in world coordinates). The front view has the Y direction pointing inside the screen.
Unreal Engine World Coordinate System
Unreal Engine uses a left-handed, z-up world coordinate system. As you can see in the picture below, the only difference between Max and Unreal is the Y vector pointing in the opposite direction. We can be sure that there is no flipping along this axis by looking at the textured quad. If it had flipped in the Y direction, we couldn’t see it since it’s a single sided quad and if you look it from behind the engine will backface cull it (i.e. it’s invisible from behind). The engine is taking care of the different coordinate system during the import phase: what we see in the front view of Max is the same thing we see in the front view of Unreal Engine, except that the Y axis is pointing in the opposite direction.
We have seen that Unreal Engine is Max-friendly about the world coordinate system. One more thing that is worth to analyze is the axis conventions used in Unreal (see the image below):
- Forward direction: X axis
- Right direction: Y axis
- Up direction: Z axis
So, if you are designing an object wich moves toward a direction (as an airplane or a car), you should point it along the positive X axis in 3ds Max in order to match Unreal conventions.
Unity 3D World Coordinate System
Unity 3D uses a left-handed, y-up world coordinate system. As you can see in the image below, when you import a mesh from 3ds Max, what you get is a very different orientation. There is a 90 degrees rotation around the X axis, which has an opposite direction compared to 3ds Max.
Below you can see the axis conventions for Unity 3D:
- Forward direction: Z axis
- Right direction: X axis
- Up direction: Y axis
Fixing orientation from 3ds Max to Unity 3D
When I put into the scene the teapot imported from Max, Unity auto sets a 90 degrees x-axis rotation for the game object, in order to compensate the coordinates change. I first thought this could be a result of checking the y-up option in the 3ds Max FBX export dialog. But when I tried to export the same mesh checking z-up in the dialog, the result was the same.
This 90 degrees rotation makes the object look correctly oriented, but it’s actually useless. If you try to use the object this way and you want to control its position and rotation via scripting, you will face a lot of problems dealing with mismatching vector orientations: your forward vector will be the local Z, which actually points up, while your actual forward vector is -X. To avoid all these direction mismatches you could parent your game object to another game object and control the latter, but there’s a better solution.
The easy way to export your 3ds Max meshes to Unity 3D is rotating the mesh pivot. You have to just rotate your pivot, making the Z axis point forward, Y axis up and X axis left. Look at the picture below to see an example.
As you can see above, by turning your pivot in Max, the imported mesh in Unity is correctly oriented. The X axis is flipped. In Max it points to the left, in Unity to the right, but the box attached to the right side of the teapot remains on the right. Notice also how the texture mapping alignment remained the same.