New answers tagged coordinates
Take a look at Viewports. Many of the Viewport subclasses take virtual height and width in their constructors. There are different flavors of viewport depending on how well you want Libgdx to keep to your desired aspect ratio.
A player can't exist at a location that isn't defined, because computers are discrete things. Bits in any representation of a number (integer or floating point) are either set or they are not set and the pattern they create defines a particular number which we interpret as location. That doesn't mean you can't have multiple coordinate systems though. Just ...
Your image is 64x64 and your Pixels To Units setting is 100. That means at native size your Sprite is 64/100 = 0.64 units wide. To make this 3 units wide, you'd need to set your local scale to 3/0.64 = 4.6875 Or, you can change your Pixels to Units setting to 64, then your sprite will come in at exactly 1x1 unit, and a local scale of 3 will make it 3 ...
My guess is you're trying to implement a camera, and should not be using SDL Viewports. The viewports are for UI elements like menus, minimaps, etc. It's a way of dividing up the screen into multiple areas. To implement a camera, you will want to think about coordinate systems. The world coordinates are the positions in the world, without thinking about the ...
try using SDL_RenderSetClipRect() instead of SDL_RenderSetViewport . Had the same problem and changed into SDL_RenderSetClipRect(). Cheers!
Depending on the library or technology you are working with - things can get easier. But it is almost always good to understand the maths behind this stuff. Have a look at the line through plane equations on Wikipedia.
Unfortunately this is quick to answer: You can't from a single image. To determine the intrinsic camera parameters (like lens distortion) you'll need at least a few pictures and more known points. If you want to read more about it, Google for "camera calibration" or lookup how some libraries do that, e.g. OpenCV. From a single image all you could get are ...
Top 50 recent answers are included