How to fit the scale, position between Unity and web browser(three.js)?

I know ThreeJS uses right hand and Unity uses left hand.
I need to convert scale, position of THREE.JS object(e.g. Cube etc) to Unity space in correctly.
For example, I create a Cube with scale(1, 1, 1).
But I don’t know the scale value for Unity.
THREE.JS scale(1,1,1) : Unity scale(?,?,?);
Likewise, position also must be adjusted.
Please help me.

Units in 3D don’t have any particular size, except for by convention.

What this means is that you are responsible for making sure that the scenes in Unity and three.js match up.

Generally, we use the convention that 1 unit = 1 meter.

If you stick to this convention when working in three.js and also when working in Unity, then everything should match up just fine.

Whenever you make a 1x1x1 cube in three.js or Unity, think of it as a a 1 meter x 1 meter x 1 meter cube. Then any scaling you apply in three.js will be the same in Unity. Position will also be the same.

If you have to match a scene that was already created in Unity, then find out what convention the artists there where using. Hopefully they were using meters, but if they were using inches instead, then take 1unit = 1inch in three.js when building your scene.

The best way to make sure you are getting a match is to create some test scenes - say, create 4 cubes with scales of (1,1,1), (2,2,2), (3,3,3), (4,4,4) and see how they look when you bring them into Unity.

Then test this with position. Try moving the four cubes to the points (0,0,0), (10,0,0), (0,10,0), (0,0,10) and make sure they are correctly positioned once you bring them into Unity.

Finally, do something similar with rotation. Then move onto some more complex scenes.

How are you exporting from three.js and importing into Unity? The exporters and loaders should take care of converting between coordinate systems for you.

1 Like

Thanks for your reply.
I will try to find a way to match between three.js and Unity.