Search Unity

Question Units of measurement and position

Discussion in 'Physics' started by AlexGreenwood, Apr 10, 2023.

  1. AlexGreenwood

    AlexGreenwood

    Joined:
    Mar 28, 2023
    Posts:
    5
    Hey people,
    I am quite new to Unity and have a very basic problem or question. Specifically, it's about the dimensions and position. The dimensions of an object are always relative. This is unfavorable when I want to adapt objects to each other. For example, I would like to be able to see an absolute value so that I can, for example, create a window pane directly to the frame. For example, if the frame is 4 x 4 meters, I can simply create an object with 4.1 x 4.1 meters and don't have to scale around. The same applies to the position, this is only identical if I reset the position beforehand, isn't it? Here, too, it would be nice if I knew on which outermost edge house A is located, so that I can place house B right next to it. How can I do that by only entering values?

    Thank you!
    Best regards,
    Alex
     
  2. AlexGreenwood

    AlexGreenwood

    Joined:
    Mar 28, 2023
    Posts:
    5
    Something else occurs to me. Especially with round objects, I can hardly get them round afterwards. For example, I only noticed later in one project that the object is not perfectly circular. I can't fix that with the relative values, I can only scale around wildly and hope that it's round. It would also be nice here if I can just type in 1 x 1 meter and it's perfectly round. Thanks!
     
  3. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    Units in Unity are 1 unit = 1 meter.

    While you could scale the objects based in your needs, all Unity subsystems assume this 1:1 scale. This is especially relevant with physics. For example, the inertia tensor of the physics bodies is calculated based in their dimensions.
     
  4. AlexGreenwood

    AlexGreenwood

    Joined:
    Mar 28, 2023
    Posts:
    5
    Thanks, but how is it possible, that I've two objects nearly the same size, but completely different values on x, y and z? No matter wich object I put in the scene, it's even 1 x 1 x 1. So a barrel is 1 x 1 x 1 a complete house, too.
     
  5. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    You're confusing scale with size.

    Scale is a size multiplier. If you have an object that's 40x20x10 meters in size, and has scale 1x1x1, it will be drawn 40x20x10 meters long. If you set scale to 2x2x2, it will be drawn 80x40x20. If you set scale to 3x1x2, the object will be drawn 120x20x20, etc.

    Unity's transform component only exposes scale. Size is determined by the mesh you're using: whoever modeled your barrel or your house meshes, modeled them at a specific size, and by default unity is drawing them at unit scale (size x 1).

    Also note this is not unique to Unity, all 3D software works the exact same way.
     
  6. AlexGreenwood

    AlexGreenwood

    Joined:
    Mar 28, 2023
    Posts:
    5
    Thanks! Now I've got it. Is it possible to see the "the real" size anyhow, too? I know this issue from Blender. So its hard so scale something exactly like another object. Only way is to build all needed objects in one session. Bit confusing cause using this objects in other projects/programs did not let you set them in relation to other objects. This handicaps the workflow. So if there is any way to see the "real size", too I would kiss your eye!
     
  7. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Most modelling software allows you to work with whatever units you want and display object sizes, Blender is no exception. I don't see why it would be difficult to make objects of a consistent size.

    Well, depends on how you want measure the "real size". If you want to know the mesh size in the X,Y and Z axis, you can use renderer.bounds or renderer.localBounds if you don't want rotation to affect the measurement. These return the smallest box that encloses the object, then you just take the bounds size.
     
  8. AlexGreenwood

    AlexGreenwood

    Joined:
    Mar 28, 2023
    Posts:
    5
    Ok, thanks!