49 votes
Accepted

Why is the origin in computer graphics coordinates at the top left?

This is caused in the history. Early computers had Cathode Ray Tubes (CRTs) which "draw" the image with a cathode ray from the upper left corner to the lower right. To ease the interface between the ...
user avatar
21 votes

How do I convert from the global coordinate space to a local space?

Okay, so Assuming that you know what the World Transformation matrix for that object A is, You just need to construct the inverse of that matrix and you will have what you need. Suppose the rotation,...
user avatar
10 votes

How do I translate a spherical coordinate to a Cartesian one?

r: radial distance θ: inclination φ: azimuth via Wikipedia ...
user avatar
  • 1,915
10 votes
Accepted

Is a custom coordinate system possible in Unity

If what you want is to bypass the floating inaccuracy caused by single point precision problem, for the sake of creating bigger environments for your game, then it depends on what you are willing to ...
user avatar
  • 4,885
10 votes
Accepted

How to use the SDL viewport properly?

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 ...
user avatar
  • 5,856
9 votes

How do I convert from the global coordinate space to a local space?

I've done this with trigonometry rather than matrixes in the past (I am a matrix noob). Ashes999's answer is halfway there, get the relative vector, then rotate that by the inverse of EntityA's angle. ...
user avatar
  • 91
9 votes

Overcoming float limitations for planet-sized worlds in Unity

That's a question that frequently pops up. I will take the liberty to forward you to another fairly detailed answer I already gave to the same issue, instead of just repeating it here: Is a custom ...
user avatar
  • 4,885
8 votes
Accepted

Get local coords from global coords

The point P to be transformed is, in homogeneous coordinates: $$ \begin{pmatrix} 50 \\ 40 \\ 1 \end{pmatrix} $$ The homogeneous transformation matrix M is (using \$cos(\frac{\pi}{4}\$) = sin(\$\frac{...
user avatar
7 votes
Accepted

Overcoming float limitations for planet-sized worlds in Unity

You're thinking in very static terms. Just because an object is half a world away doesn't necessitate any issues. If entity coordinates are stored relative to chunk rather than relative to world, ...
user avatar
  • 29.1k
6 votes
Accepted

How do I convert screen coordinates to between -1 and 1?

Your description is a bit vague, but it sounds like what you're trying to do is map coordinates from one space (the window coordinates) to another (your tile coordinate space). Doing so is a simple ...
user avatar
  • 3,781
6 votes
Accepted

Convert Screen coords to World Coords LIBGDX

Try using this Camera:unproject method: ...
user avatar
  • 935
6 votes

How do I convert from the global coordinate space to a local space?

Let me try to give you something somewhere between The Light Spark's answer and Elliot's answer, because from what I read, you're really looking for an algorithm to follow and not just math tossed at ...
user avatar
6 votes

How can I randomly generate objects inside of a Complex Area?

Triangulate the area. Pick a random triangle. Generate a random point inside that triangle (link).
user avatar
6 votes
Accepted

Finding all hexagonal grid coordinates inside cover arc

I prefer to do hex-cell coordinate math in what Amit calls cubical coordinates on your linked page. For the rest of this answer, (X, Y, Z) will refer to cubical coordinates. Basically, for any of ...
user avatar
  • 8,954
5 votes
Accepted

How do I translate a spherical coordinate to a Cartesian one?

http://blog.nobel-joergensen.com/2010/10/22/spherical-coordinates-in-unity/ ...
user avatar
5 votes
Accepted

How to match user click and the sprite object position in libGDX framework

Before using the coordinates of your touch event, you need to scale them to your camera dimentions. You can try this code : ...
user avatar
5 votes

What are the advantages/disadvantages of using a polar coordinate system in a video game?

Short answer: Polar coordinates are a non Euclidean coordinate system. This means that lines created in this coordinate system are not straight, so it isn't usually used as the primary coordinate ...
user avatar
  • 757
5 votes

Why is the origin in computer graphics coordinates at the top left?

This is a great question that I've thought of many times. The simple answer to "why" is because TV formats also drew their lines from left-to-right then top-to-bottom. Original computer monitors were ...
user avatar
  • 308
5 votes
Accepted

Finding a tile number in a grid system

The only way I know of, or at least can think of right now, is the following: Prerequisites: You need to know the width and height of your grid the tile numbers must increase successively, so like ...
user avatar
  • 163
5 votes
Accepted

Handedness of 2D coordinate systems

It entirely depends on what you want to do with it and both have reasons why they exist. The one where the top left corner is the origin and the positive xes point away from them are based on the way ...
user avatar
  • 14.5k
4 votes
Accepted

How do I get the mouse coordinates relative to my whole scene with Monogame?

I don't have a specific example for an Isometric camera, but it sounds like you are asking about the basic camera system in general. The camera I use in my games is somewhat simple and is illustrated ...
user avatar
4 votes

Colision detection of disc (Maximum Material Condition aka "Flatness")

I'm not entirely sure I understand the question but, given a 3D point cloud with a 2D "shape" (like a disc) the problem is simply one of dimension reduction. The algorithm you're looking for is ...
user avatar
4 votes

Why is the origin in computer graphics coordinates at the top left?

Addendum: Early graphics were done on vector monitors, just one step up from the oscilloscopes seen in the lab where (0,0) would be in the exact middle of the screen, subject to some knob turning to ...
user avatar
4 votes

Is a custom coordinate system possible in Unity

I doubt that there's a way to change the coordinate system Unity uses internally for its transforms/physics/etc. Not without recompiling the engine source at least. But that may not be necessary to ...
user avatar
  • 112k
4 votes
Accepted

LibGDX Overlay Game with Stage

You need to project from the worldspace to screen space using the correct camera, not the project method on the Vector2. Then ...
user avatar
  • 4,226
4 votes

How can I randomly generate objects inside of a Complex Area?

This might not be the most elegant solution, but it might work for you: Define that shape as a PolygonCollider Get the bounding box of that collider (...
user avatar
  • 111k
4 votes

Convert quaternion to a different coordinate system

Summarizing your two coordinate spaces: ...
user avatar
  • 112k
4 votes
Accepted

Why does the Debug.DrawRay return these weird lines

You're drawing Rays, not Lines. This means that the second parameter is a direction not a point in space. https://docs.unity3d.com/ScriptReference/Debug.DrawRay.html Draws a line from ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible