Skip to main content

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
1 answer
87 views

remaking Pong in Godot but the opponent AI cannot locate the ball's coordinate correctly

I'm following a detailed YouTube tutorial on remaking Pong in Godot 3.0 but I have ran into an issue regarding the way the AI opponent reacts to the incoming ball, what's happening is that the ...
buzzbuzz20xx's user avatar
0 votes
0 answers
37 views

Isometric building system and coordinate calculation

I am a Unity newbie and trying to implement a simple building system in a prototype of the game. The scenario is: Clcik on the UI Button Move the coursor to the desired position Click left mouse ...
Valeriy's user avatar
  • 13
0 votes
1 answer
87 views

Normalized coordinates not translating to screen coordinates the way I need them to

I am making a simple game in C# using pictureboxes. I want to move a picturebox on a form. Once this picturebox is placed in a new location, I normalize its X,Y coordinates between [0, 1] and then ...
CluelessWizard's user avatar
0 votes
1 answer
44 views

Checking if I am looking through a window using angles

I am developing a mod for a game with a Lua api. I am trying to detect if I am looking through from behind a window when I shoot an enemy. For context, when I shoot through this window I apply a ...
Ben R's user avatar
  • 1
0 votes
0 answers
60 views

Is this gimbal lock I'm hitting even with rotation matrices / quaternions?

I'm spawning a trigger box relative to another object using local offset. The engine I'm using does not provide a native function to make that conversion (at least in a way accessible to me), so I am ...
Drew's user avatar
  • 176
1 vote
1 answer
68 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
71 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
75 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
1 answer
58 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
142 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
174 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
45 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
2 votes
2 answers
1k 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
  • 227
1 vote
1 answer
528 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
50 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
242 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
104 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
241 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
661 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
296 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
115 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
60 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
613 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
1k 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
279 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
208 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
221 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
  • 226
6 votes
1 answer
3k 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
549 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,035
0 votes
1 answer
87 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
90 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
270 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
116 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
565 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
67 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
215 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
29 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
549 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
689 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
152 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
124 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
226 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
130 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
151 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
75 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
380 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
123 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

1
2 3 4 5
7