0
\$\begingroup\$

I searched the Internet for these two terms, but there is no reference to them. I just started learning LibGDX, so please explain in the simplest way possible

\$\endgroup\$
1
1
\$\begingroup\$

These terms are not specific to libgdx, really.

"Pixel coordinates" are positions that correspond directly to pixels on a screen or in an image. They tend to be a natural fit for working and thinking in 2D: an object at (0,0) might be at the bottom-left of the screen. An object at (15, 0) would be 15 pixels to the right of that first object.

"World coordinates" have a less fixed reference. In 3D graphics, geometry (stuff you draw) tends to flow through a series of coordinate systems. Things start in model (or object) space, where they are defined, usually in such a way as to center the geometry around the origin of this coordinate space.

Geometry is then transformed from model space to world space, which is a coordinate system where the origin is at some defined central or logical location for the map/world/level/et cetera. This transformation into world space occurs for each model based on where that model should exist in the world.

There are further coordinate systems after this, but you didn't ask about them specifically and they don't have an additional bearing on the definitions. What remains that is important is that model and world space don't have fixed metrics. Pixel coordinates do: moving from (0,0) to (10, 0) moves you ten pixels.

But model and world space don't have fixed metrics, it's up to you and your program to assign values and meaning to the numbers. Moving from (0,0,0) to (10,0,0) in world space could mean moving ten feet, ten miles, ten meters, or ten pixels, depending on how you are choosing to interpret the values of the coordinates.

\$\endgroup\$
2
  • \$\begingroup\$ Finished up mine at like the same time dang. But I think in yours it is worth mentioning the matrices that the 'geometry' goes through to change systems. \$\endgroup\$ – n_plum Feb 7 '17 at 17:24
  • \$\begingroup\$ Good answer, no need to write another one. In addition, I'd mention the abstraction of world coordinates, used as a metric system independent from the device the game is running on, as you said. \$\endgroup\$ – liggiorgio Feb 7 '17 at 18:34
0
\$\begingroup\$

I will assume that it refers to coordinates in the same style as most other systems.

World Coordinates: Coordinates in respect to the larger world. These coordinates are relative to a global origin of the world, together with many other objects also placed relative to the world's origin.

Pixel (Local) Coordinates: Coordinates of your object relative to its local origin; they're the coordinates your object begins in.

World Space: If you import all your objects directly into the application they would all be stacked on each other around the world's origin of (0,0,0). The coordinates in world space are exactly what they sound like: the coordinates of all your vertices relative to a (game) world. This is the coordinate space where you want your objects transformed to in such a way that they're all scattered around the place (preferably in a realistic fashion). The coordinates of your object are transformed from local to world space; this is accomplished with the model matrix.

The model matrix is a transformation matrix that translates, scales and/or rotates your object to place it in the world at a location/orientation they belong to. Think of it as transforming a house by scaling it down (it was a bit too large in local space), translating it to a suburbia town and rotating it a bit to the left on the y-axis so that it neatly fits with the neighboring houses.

Local Space: Local space is the coordinate space that is local to your object, i.e. where your object begins in. Imagine that you've created your cube in a modeling software package (like Blender). The origin of your cube is probably at (0,0,0) even though your cube might end up at a different location in your final application. Probably all the models you've created all have (0,0,0) as their initial position. All the vertices of your model are therefore in local space: they are all local to your object.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.