# World Unit confusion

I'm new to game design theory so a few small things confuse me. If someone could help me understand world units I'd appreciate it:

If I design a model in some CAD program to be a 12"x12"x12" cube, then load this at scale into the game engine, how many "world units" is that? I realize everything in the game engine is relative and can be scaled, but I'm working on a real-world simulation environment which includes maps and models based on actual objects and places and need to relate movement across the map as actual GPS coordinates.

After working my way through the first few JME3 tutorials, I'm having similar feelings. Why is it that, when I move an object up by 1.0f, this constitues 2 world units? Wouldn't it be more intuitive is a translation of 1 constituted 1 world unit? Having a translation of 1 constitute 2 world units seems a bit weird to me at least. In the end, once you know this you can work with it. But for people new to JME it feels weird.

Trust me ractoc, nobody defined anything in the engine like WORLDUNIT = 2 or something.

People seem to ask this question a lot, about what units does the engine operates is, the answer is, in whatever unit you want. You can decide for example that 1 unit in the engine is a meter, then model everything in your modelling tool so its in meters.

If you create a 12" cube in your modelling tool then it should be a 12" cube in the engine, simple as that.

There are however some exporters which scale the model upon export, this is incorrect and really there should be an option to disable that.

Ok, that explains a lot. Just weird to have that world unit = 2 in the turorials then.

See the part "understanding the code" in the "Getting Started with JME3 (2) - Hello Node" tutorial. In there there are multiple references of 1 unit being refered to as 2 world units.

If the world units are something everyone can define for themselves for their own game, these references should perhaps be altered?

ractoc said:

Ok, that explains a lot. Just weird to have that world unit = 2 in the turorials then.

See the part "understanding the code" in the "Getting Started with JME3 (2) - Hello Node" tutorial. In there there are multiple references of 1 unit being refered to as 2 world units.

If the world units are something everyone can define for themselves for their own game, these references should perhaps be altered?

I assume you're referring to this:
Its extends are (1,1,1), that makes it 2x2x2 world units big

You've misunderstood what the tutorial's trying to explain. The point is if it extends by 1 unit, in each direction (ie. in the +x, -x, +y, -y, +z, -z directions), then the cube is 2x2x2.
Momoko_Fan said:

You can decide for example that 1 unit in the engine is a meter, then model everything in your modelling tool so its in meters.
If you create a 12" cube in your modelling tool then it should be a 12" cube in the engine, simple as that.

I actually thought about this too: isn't there some basis for light and sound falloff? For example, the light gradient from creating a pointlight would depend on units.

The light and sound (if I recall) take a radius parameter. Those are of course in the world unit that you use in the engine.

I know this is an old thread, but I forgot to post this a while ago. I'm still having trouble conceptualizing world units so I did a few tests:

I exported models of cubes of different sizes. I then loaded them into JME next to a 1 world-unit model. From that I found that 1 world-unit  = 1 meter.  This seems to hold true with my other models as well.

So I exported a 12" cube, as mentioned before. Compared to the 1 world-unit cube, it was about 1/3 the volume.

I'm not seeing how the world unit  is "whatever I want it to be" when it is clearly not 1 foot if I load a model of 1 foot next to it. What am I missing here?

What do you use for modeling and exporting?

If it's Blender and Ogre xml, make sure you are in Edit Mode when scaling your cubes in Blender.

In this case I used Google sketchup with the OgreMeshXML exporter plugin and the OBJ exporter. in Sketchup Pro  It allows export unit selection.

It's possible the exporter is not considering units into account or handling it incorrectly, there's really nothing we can do about that. You can try looking at what the script does or ask the author about it.

<cite>@InfernoZeus said:</cite> <br /> <br /> I assume you're referring to this:<br /> <br /> <br /> You've misunderstood what the tutorial's trying to explain. The point is if it extends by 1 unit, in each direction (ie. in the +x, -x, +y, -y, +z, -z directions), then the cube is 2x2x2.

Is this true for getWorldBound.getXEntent() as well??
So a box with (1,1,1) parameters return 1 as X entent but actually spans 2 wu in x direction.

@simar.i3r said: Is this true for getWorldBound.getXEntent() as well?? So a box with (1,1,1) parameters return 1 as X entent but actually spans 2 wu in x direction.

Yes. Think of â€śextentâ€ť like â€śradiusâ€ťâ€¦ but axis aligned.

This is actually a big confusion because the name of the function suggest otherwise and I canâ€™t find any javaDoc suggesting otherwise as wellâ€¦

Still, I got it. thanks a lot!!

@simar.i3r said: This is actually a big confusion because the name of the function suggest otherwise and I can't find any javaDoc suggesting otherwise as well..

Still, I got it. thanks a lot!!

(shrug) In 3D graphics, â€śextentâ€ť pretty commonly means â€śhalfâ€ť in this case. Thatâ€™s why itâ€™s â€śextentâ€ť versus â€śsizeâ€ť.

2 * radius = diameter
2 * extent = size

â€¦pretty common, I think.

â€¦anyway, yeah the docs for Box are a bit confusing (maybe even wrong):

public final float getXExtent() Get the x-axis size (extent) of this box.

including the word â€śsizeâ€ť is just confusing.

Got it thanks,

Hopefully someone may get here searching and learn thisâ€¦

Maybee we should juse use a sphere where possible in that first tutorials? As a radius is more commenly known then the extend.

+1
My suggestion is that you should mention the meaning of extent as well may be as a note.

A cube shows movement better though (as you move the camera). In unlit single colour a sphere just shows as a circle on the screen whereas a cube changes shape.

A comment to explain extents on the other hand makes a lot of sense!

(Incidentally I know it was 3 years ago but 12" = 1 foot which is around 1/3rd of a meterâ€¦so importing a 12" cube you would expect it to be about 1/3rd of a world unit.)