Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to work with units (meters) in unity

Tags:

unity3d

I don't really know how to work with units in unity.

Google told me, that unity's default is: 1 unit = 1 meter.

The problem is: When I create a cube I cannot tell what its size should be. It is created with the following scale: (1, 1, 1) But I do not have any information what its dimension in meters are.

When I create a Plane it also show me a scale of (1, 1, 1) but is nearly 10 times the size of a cube.

So how is it possible to do stuff like: Create cube with height 2 meters, create a plane with dimension 5*5 meters, when I am not able to set the actual size?

like image 629
Subby Avatar asked Feb 22 '15 14:02

Subby


2 Answers

Units are somewhat arbitrary in 3D engines, even Unity. Though sometimes there will be aspects of the engine that expect a certain unit to real-world scale.

Picking 1 unit to = 1 meter is a safe bet in Unity for most projects.

When you create a cube, the included mesh is designed to be 1 unit X 1 unit X 1 unit. So the cube would indeed be 1 unit tall.

The plane primitive, however, is 10 units x 10 units square. So when you create one it is 10 times bigger than the Cube. It was just arbitrary that they made it that way. If you select the plane you'll see that it's actually a row of 10 by 10 quads, each quad of the plane is 1 unit by 1 unit.

Later versions of Unity added a Quad primitive which is 1 unit by 1 unit.

Generally you do not create geometry in Unity, but rather in an external 3D modeling package. As you already know, Unity does have some built in primitives, which are useful for "white boxing" things; stand-ins for later geometry.

In the case of the cube, if you want it to be 2 meters high (aka 2 units), then set the Scale Y to 2. This works because the cube is 1 unit high already.

For the plane, which is 10x10, set the X and Z scale to .5 to get 5*5 units (meters).

like image 146
nsxdavid Avatar answered Oct 15 '22 20:10

nsxdavid


In addition to what @nsxdavid said, the most important thing you must have in mind is consistence: your project must be attached to a certain predefined scale. Once you've settled this, in meters, feet or "unity scale", take note of the primitives' size and stick to it, this way the actual units won't be that important but the coherence between the prefabs.

like image 26
Diego Alares Avatar answered Oct 15 '22 21:10

Diego Alares