Questions tagged [coordinates]

Numeric representation of the location of an entity in the game space. There are multiple forms of coordinate systems to cater to a variety of methods to map position.

Filter by
Sorted by
Tagged with
1 vote
0 answers
52 views

Selecting Tiles Correctly With Scroll

I would like to understand the process of selecting the correct tile from a scaled Surface when I have information about the number of tiles on the x and y axes, the length of the Surface, and also ...
anathrax's user avatar
0 votes
0 answers
51 views

Get coordinates of clicked point on screen in model space

There is a 2D object located in the coordinate range -1 to 1. In world space, it is also located in these coordinates, but with a shift along the z axis. The actual initialization of the model, view ...
Ar4's user avatar
  • 1
0 votes
1 answer
57 views

Is vertex coordinate limited to -1 to +1f range

I thought that everything outside of [-1.0f, +1.0f] should not be renderable in Open GL. However, this code renders just fine with Silk.NET. I draw 3 axes and one ...
Anonymous's user avatar
  • 111
0 votes
0 answers
31 views

How do i put an entities x,y and z coordinates to a variable(?) in Blitz3D?

I'm making a TEST 3d platformer where the camera follows the player from above. Normally I would make the camera move at the same time when the player moved, for example: ...
Probes's user avatar
  • 1
0 votes
2 answers
83 views

Convert terrain vertex position to global position

I am trying to set the terrain's heights data at runtime with a simplex noise function, while stumbling with converting the local position of the vertices to global position to use as input to keep ...
Willem's user avatar
  • 165
0 votes
1 answer
163 views

Changing GameObject Position with the new InputSystem Unity 2D

I am making a little top-down 2D RPG right now and I'm struggling with the range of my attacks. The problem is that my range is stuck on the right side of my player. This is of course really annoying, ...
Hammynator's user avatar
0 votes
0 answers
42 views

Resample image of sphere to match appearance of rotation

I am rendering sphere to a texture. Now, I have screen space texture, and I need to offset this texture based on screen space movement (dx, dy) and render it to a new texture. For example, the left is ...
Martin Perry's user avatar
  • 1,106
1 vote
2 answers
895 views

How to convert a 4x4 matrix transformation to another coordinate system?

Is there a general method to convert a matrix transformation from one coordinate system to another, so that the resulting transformation looks the same on screen? For example: There are some ...
thalm's user avatar
  • 217
1 vote
1 answer
409 views

Algorithm for taking the shortest path between two XY coordinates

I am making a simple game in Phaser (but the library doesn't really matter). I have an enemy that is moving towards the player on a 2 dimensional grid. I have written some code that makes the enemy ...
yesman's user avatar
  • 113
0 votes
1 answer
49 views

Changing Coordinate Origin [From Coord System A -> Coord System B]

I'd really appreciate some help on this one. Given 2 coordinate systems A and B where xA is an initial Vector3 position, rA is an initial Quaternion rotation xB is an initial Vector3 position, rB is ...
G.Pap's user avatar
  • 3
-1 votes
2 answers
185 views

Why does the setPosition function in SFML require the x and y arguments both floating-point numbers, not integers?

Why do the coordinates x and y in the 2D game both floating-point numbers, not integers? For example, the SFML setPosition function requires two floating-point ...
Đạt Phạm's user avatar
0 votes
3 answers
90 views

Should the coordinates, and rotation angles of all the sprites be stored in variables?

I've learned that magic numbers are bad in code. However, should the coordinates, and rotation angles of all the sprites be stored in variables? Is the convention in game development to leave those ...
Đạt Phạm's user avatar
0 votes
1 answer
213 views

Bottom-left cell position is incorrect?

I need to get the position of the bottom-left cell on my tilemap. I used Floor.CellToWorld(Floor.cellBounds.min) (Floor is the name of my tilemap) and I used Gizmos ...
Arian_ki's user avatar
  • 691
0 votes
1 answer
478 views

Calculate the coordinates of an offset in 3D space knowing the initial rotation and final rotation of the object

Working on a game mod in FiveM in which I am representing bullet impacts with drawn lines in the game world along their flight path. I am getting a normalized vector and then calculating the offset ...
user2828652's user avatar
1 vote
1 answer
286 views

How to define custom coordinate space?

I'm trying to build small UI framework. And I want it to have a coordinate space such that origin is placed in top left corner (x increases to right, y increases to down). I think for UI it should be ...
ChessMax's user avatar
0 votes
1 answer
97 views

Converting mesh vertices to world coordinates for raycasting

My goal is to figure out if a point exists within a 3D polygon. To do this here is what I am doing: Load obj mesh ...
joethemow's user avatar
  • 101
0 votes
0 answers
52 views

Trying to understand proper naming of transformations and coordinate systems

So far in my code I only dealt with transform matrices that I fed to OpenGL (the 4x4 float matrices), and had a class that was used to do transformations on the CPU side and generate the OpenGL ...
Newline's user avatar
  • 173
2 votes
1 answer
539 views

LookRotation function for Z-up, right handed system

I am rendering graphics myself using OpenGL, therefore I need to implement math library myself. I am looking for function Quaternion::LookRotation(forward, up), ...
Andy's user avatar
  • 123
0 votes
1 answer
865 views

OpenGL gl_Position z-range and depth buffer range

Am I correct that the OpenGL depth buffer has values between 0 and 1 while the z component of gl_Position is between -1 and 1?
wedesoft's user avatar
  • 125
1 vote
1 answer
256 views

How can I get correct coordinates from a diamond isometric map created in Tiled?

I am rendering a diamond isometric map created in Tiled using Monogame.Extended.Tiled package. Here is where I'm trying to spawn a player with an object at ...
Emobe's user avatar
  • 11
2 votes
0 answers
167 views

Finding points on a face of an icosphere

I am working on a game the ultimately will be a tactical game on the surface of a sphere. To model the surface of a sphere I have chosen to use an iterated icosphere, where each face is iterated quite ...
Amabaku's user avatar
  • 21
1 vote
1 answer
192 views

Ensure that random enemies don't spawn just near the player

I need to find a method using which I can ensure that random enemies and objects don't spawn just near the player. In fact, if they do, the player will be more likely to collide with them and lose. ...
Salem's user avatar
  • 216
6 votes
1 answer
2k views

How to raycast down to the floor plane to determine world space coordinates in Godot

I've been trying to find a solution to this task and despite finding answers to similar issues, they were always somewhat overcomplicated (e.g. finding a position on a texture) or the problem was ...
Marty Cagas's user avatar
1 vote
1 answer
461 views

How do game engines enforce global, engine-specific coordinate systems?

In Unreal, the 3D coordinate system is defined as a right-handed, X-forward, Y-left, Z-up frame of reference; but, the default 3D coordinate system for, say, DirectX is a left-handed, X-right, Y-up, Z-...
Casey's user avatar
  • 2,000
0 votes
1 answer
82 views

Calculate how many degrees a physical device is off centre (offset) given X, Y, Z

Let's say I have a physical device that I can rotate with my hands and receive X Y Z coordinates of that device. What I need to calculate is the offset - how far is the pendulum of gravity straight ...
lipa's user avatar
  • 3
0 votes
0 answers
71 views

How to check if a particular vector is pointing at X-Y plane or Y-Z plane

As you can observe from the diagram, Vector A is pointing at the Y-Z plane and Vector B is pointing at X-Y plane. Is this possible to find? Am I missing some logic or concept? EDIT: Suppose, Vector B ...
MrRobot9's user avatar
  • 321
0 votes
1 answer
2k views

convert world to screen coordinates with camera position and camera angle

Heyho :) I'm trying to convert world coordinates to screen coordinates. I have available: fov, screen width, screen height, camera position, camera angle and obviously the position of the object in ...
itsame's user avatar
  • 1
1 vote
1 answer
234 views

Unity Animation makes object spawn at x0 y0 z0

I was making an animation for a coin in my game in Unity, and when I was testing the full game, I saw that the coin is spawning at x0 ...
GospelBG's user avatar
0 votes
0 answers
96 views

What is the math to project a 3D object's center onto a 2D plane?

What I really need is the x,y of the object when it is outside of the screen: I'm actually coding a UI in Objective-C, not a game. In this different kind of UI you navigate a 3D space with objects. ...
Vulkan's user avatar
  • 101
0 votes
1 answer
454 views

Convert Global Space 3D Location to Local object space?

I'm trying to find a formula that could convert my 3D global coordinates into local object space. Here are the inputs I have ...
DB3D's user avatar
  • 103
0 votes
0 answers
57 views

Gauss-Krüger system to Unity Coordinate Conversion

In my recent project, I am getting an object file via a request to REST API and found that the OBJs (object file) are in Gauss-Kruger System. I want to know that how exactly I place the model as I ...
Muhammad Faizan Khan's user avatar
0 votes
1 answer
1k views

How to use X,Y, and Z instead of Pitch, Roll and Yaw

I'm learning Unreal engine, and I'm rather disappointed because it uses pitch roll and yaw instead of the standard x, y, and z that I'm used to. Is there any way to convert this easily, or is there a ...
Millard's user avatar
  • 500
0 votes
0 answers
184 views

Shifting the world origin and scaling all points?

Imagine you have a simulation in very large coordinates, and to render it out you need to scale it down (say, solar system -> fitting inside a few thousand units). This is controlled by a float ...
HateDread's user avatar
1 vote
0 answers
28 views

Formula to convert zoomed in game space co-ords to UI

I need to come up with a formula to convert variable zoomed-in game space co-ords to UI co-ords. The engine I'm using is not traditional so there's no inbuilt function (convertToUISpace etc). Now I ...
Mushington's user avatar
0 votes
1 answer
499 views

Convert GPS coordinates into Unity world space?

I am developing an AR application where a number of historical buildings are spawned around the player depending on his position when a target / QR Code is recognized. I know the Lat/Lon of these ...
Steffan's user avatar
  • 103
0 votes
1 answer
646 views

Unity - Transforming horizontal distance between two spriteRenderers to set UnityEngine.UI.Button width to this distance

In my Unity scene, I have a couple of spriteRenderers and a UnityEngine.UI.Button called ...
ChrisC's user avatar
  • 116
2 votes
3 answers
148 views

Algorithm to check whether pizza toppings are divided half-and-half

Using Unity, I am creating a 2D pizza game and I am stuck at finding an algorithm to solve this problem which is Detecting if the pizza is half and half taking into consideration that the user can put ...
A.J's user avatar
  • 151
0 votes
1 answer
117 views

LibGDX changing actors parents is resulting in unwanted (x,y) translation

I have a Rolodex of task item actors I want to drag to an agenda tablet. My drag and drop functionality is non-native, but came from modifying a book's implementation. The problem seems to be when I ...
RocketScienceGuy's user avatar
2 votes
1 answer
207 views

Diamond shaped map: converting tile number to coordinates and back

I have a diamond shaped map that is displayed as follows: ...
Frank's user avatar
  • 23
1 vote
1 answer
119 views

How to use WorldToScreenPoint function in a texture context?

I am rendering a scene into a RenderTexture and I have a set of 3D points. I want to convert these points from 3D to texture coordinate frame. It worked, when I rendered into screen and used ...
Hillbilly Joe's user avatar
0 votes
1 answer
147 views

GameObject LookAt not aligning properly

I have a celestial sphere with a plane in the centre and spheres (stars) aligned around the centre with a fixed radius. In order to show the stars visible from a certain latitude and longitude from ...
SidS's user avatar
  • 171
0 votes
1 answer
73 views

How to convert point coordinate when taking a snapshot?

Can anyone explain me please how to convert point from Screen-coordinate system to Texture 2D? The screen size say for example 700x500 and Texture2D must be of size 1024x768. I am getting points from ...
Hillbilly Joe's user avatar
0 votes
0 answers
344 views

How to properly resize canvas according to screen size? (Javascript)

So, as the question says I need to resize the canvas according to screen size. However the thing is that that's not it. I also need to have the mouse coordinates updated proportionally. Seems like I ...
Nirabhra's user avatar
0 votes
1 answer
5k views

Unity: AddForce in transform.forward direction not working as expected

I am building a very simple car-driving game in Unity. I have a Player object, which looks like this: As you can see, I have a Rigidbody2d component attached to this object, as well as a script, ...
ChrisC's user avatar
  • 116
0 votes
1 answer
117 views

Conversion between coordinate systems

I have a chunk system that I created for my tile-based game, however I am having problems translating the coordinate in tiles of the cursor to the coordinate in chunks. This is my code so far: ...
Simple coder's user avatar
0 votes
0 answers
38 views

Swapping Y and Z in quaternion [duplicate]

I am converting between coordinate systems where Z is the vertical axis in one, and Y in another. I have the rotation values represented as a quaternion. I see this related issue but it's switching ...
Satchmo Brown's user avatar
2 votes
1 answer
269 views

Scaling a rotated child with parent-child transforms

In unity, if you parent something to another object, then give the child some rotation, and scale the parent, the scale applies to some arbitrary axis to the child, here's some pictures to demonstrate:...
DavidColson's user avatar
0 votes
0 answers
15 views

World coordinates on vertical grid game for different aspect ratios (Unity) [duplicate]

new to game development and unity so hopefully someone can help. I want to make a 2D portrait mobile game that will have a grid of constant size where units can move on in Unity. This should support ...
Tonidero's user avatar
1 vote
2 answers
176 views

Dividing coordinate into unit cube

I'm trying to write a Java class to generate Perlin Noise from a Cartesian coordinate. I'm trying to follow this tutorial but I am struggling to understand the theory. Specifically, how do you divide ...
joshua jackson's user avatar
1 vote
0 answers
110 views

How to place the origin of an isometric map at the top, not the left

I have an isometric diamond-shaped map. Currently my map origin is to the far left, instead of the top. The green circle at the top-center of the map is where I want the origin point to be, however ...
Matias Persson's user avatar

1
2 3 4 5
7