# Tagged Questions

The physical location of an entity inside the game space, be it visible or invisible, absolute or relative.

2k views

### How to implement time traveling into a game?

I was wondering how to implement time travel into a game. Nothing super complex, just time-reversal like what's in Braid, where the user can rewind/fast forward time by 30 seconds or whatever. I ...
637 views

### How should one handle positions in a tile-based world?

I have a simple Tower Defense game using a tiled world. Creep and towers are on a tile at all times. How should I represent the position of creeps in code? (Do creeps know their current tile and ...
417 views

### What data should I use to track the player position on a world at the same size of the earth in a multiplayer game?

I guess this kind of game or simulator already exist somewhere, but I'm not sure... Let's imagine I'm making a game where the proportions of the planet earth and the humans beings on it are the same ...
2k views

### How would one determine the position of a participant in a racing game?

Now, for the record, I'm currently not implementing any racing game whatsoever, but this problem just popped into my mind and now I'm curious. So how would one go about finding out which participant ...
1k views

### Determing an object's position along a curve over time

I have some objects in my game which are "thrown". At the moment I am trying to implement this by having these objects follow a parabolic curve. I know the start point, the end point, the vertex and ...
1k views

### Kepler orbit : get position on the orbit over time

I'm developing a space-simulation related game, and I am having some trouble implementing the movement of binary stars, like this: The two stars orbit their centroid, and their trajectories are ...
527 views

### Get position of tile in tileset

How can I get the position of tile 14 (or any other) when only knowing the following: Tile ID: 14 Rows: 4 Columns: 7 The end result should be 2x4.
4k views

### Smooth Sprite Movement - Don't Add Velocity to Position?

I am trying to figure out if there is a way to move a sprite smoothly on the screen at different speeds without stuttering, but keeping the effect that it's moving smoothly; especially at faster ...
5k views

### Find Point with only angle and distance

I'm working on a school project and we have to create a tank team with the programming game Robocode (tank battle with self programmed bots in Java). I have to program a scout bot that scans, finds ...
322 views

### Entity position: In map or in script?

I'd like to know how others have handled the issue of storing the entity's position. (Or maybe it's not an issue and I just make it too complicated.) I'm undecided on whether to store the position of ...
1k views

I've have read this interesting question, where is explained how to simulate positional sound with the left and right channel; but still I wonder: is it possible to simulate positional sound (with ...
451 views

### Java: AI to make a mob face the player working half-way correctly

While creating some basic AI for my "ghost" mob that is just up for testing at the moment, I thought of allowing it to face the player, depending on the player location. I get it to work correctly, ...
625 views

### MMOFPS Choosing protocol for high-traffic network (UDP or TCP)? [closed]

my question about the player position sender protocol. In this article, he says "Never use TCP for networking a multiplayer game". Ok but UDP datas are not ordered. In this case, if somebody walking, ...
164 views

### How to make an object stay relative to another object

In the following example there is a guy and a boat. They have both a position, orientation and velocity. The guy is standing on the shore and would like to board. He changes his position so he is ...
338 views

### Retrieving model position after applying modeltransforms in XNA

For this method that the goingBeyond XNA tutorial provides, it would be really convenient if I could retrieve the new position of the model after I apply all the transforms to the mesh. I have edited ...
189 views

### Camera placement sphere for an always fully visible object

Given an object: With the bounds [x, y, z, width, height, depth] And an orthographic projection [left, right, bottom, top, near, far] I want to determine the radius of a sphere which allows me to ...
879 views

### Making mouse pos realtive to a moving object

I'm coding my first actual game, trying without following tutorials, just trying to use my knowledge so far to make something playable. I'm creating (attempting) a simple side-scrolling shooter. I ...
114 views

### How can I make an object move in four directions relative to its rotation?

I want to make a game object move in directions relative to the direction is facing. That is, If the user presses the "W" key the object goes "forward" if its presses "D" the object goes to its left. ...
570 views

### multiply matrix by vector: what to do if need to change y-up to z-up?

I multiply a matrix with a position vector to get a new position, however, now I need to change my matrix from y-up coordinate space to z-up. Changing only the matrix won't work: how to apply the ...
543 views

### Why are my 2D positions “off” after adding a camera transformation in XNA?

My game's source is on github. I am following this tutorial to create a 2D camera. After I adding the transformation to the SpriteBatch, all of my positions seem to be "off" when I move the ship (and ...
191 views

### How to put the game object to the upper left corner of the screen in Unity and make it visible entirely on all screens of mobile devices

I have game object which displays health indicator in my 2d video game in Unity. This gameobject contains a lot of sprites and i put it into left/top corner of the screen. In my game editor it is ...
152 views

### Formula for Planetary Alignment

I am attempting to create a game where there is a universe of two 16-bit addresses ranging from -32768, -32768 to 32767,32767, or in hexadecimal, each value can run from \$8000 to \$FFFF then 0 to ...
2k views

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

I am using libGDX Java framework for developing a practice game in Eclipse. My game is in landscape mode and I am using sprite image for game assets. Actually I am trying to follow the Kilobolt ...
440 views

### Position Reconstruction from Depth by inverting Perspective Projection

I had some trouble reconstructing position from depth sampled from the depth buffer. I use the equivalent of gluPerspective in GLM. The code in GLM is: template GLM_FUNC_QUALIFIER detail::tmat4x4 ...
332 views

### delay camera xna

I read this tutorial http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2/Camera_delay.php but i didnot unsterstand it. Is there another way to delay the camera position movement without this ...
58 views

### How do I render an object's position trail of a constant length?

I want to show a trail of the last points that the object has been in, but I want that trail to always be a certain length, regardless of the object's speed. How can I do that? At the moment, I ...
508 views

### Moving an object around the the circle to the specific location in circumference

Well I have run out of ideas how to approach this particular problem.See the picture below: So the idea is that the object (dot in black) has to get to a point mark X (red X mark).However the ...
167 views

### Logic that can traverse all possible layouts, but not checking every combination of identical pieces?

Suppose we have a grid of arbitrary size, which is filled by blocks of various widths and heights. There are many 2x2 blocks (meaning they take a total of 4 cells in the grid) and many 3x3 blocks, as ...
77 views

### An approach for storing points in space

I am going to work on my next game project, however there are some issues I want to correct since my last one. Here is one of them: This is a problem I think I can already solve, but I'd like to hear ...
1k views

### Positioning a sprite in XNA: Use ClientBounds or BackBuffer?

I'm reading a book called "Learning XNA 4.0" written by Aaron Reed. Throughout most of the chapters, whenever he calculates the position of a sprite to use in his call to SpriteBatch.Draw, he uses ...
5k views

### Looking at the mouse position in a top down Unity game?

I'm trying to make a simple top down game where the player looks at wherever the mouse is pointed. The player is only going to rotate on the Y axis. Here's what I have so far but I can't seem to get ...
174 views

### 2D HLSL World position

I'm trying to get world position from my vertex shader to my pixel shader so that I can disable the shader once a preset X coordinate has been passed (no shading once I'm over X). Getting the screen ...
383 views

### Java: See if Mouse is hovering/clicking Sprite

The game I am developing is in which you defend the Cell from the Viruses, and I need the sprites to have a MouseListener for when the mouse clicks on that sprite, it will get destroyed, and I cannot ...
409 views

### Scene graphs vs in-game representation

This is a general question which aim is to allow me to start digging on the subject by myself. As I noticed the general opinion is that scene graphs are good for describing the scene in a level ...
40 views

### parented/constrained object transform lags when moving character in unity3D

Hi I have a simple raycast-base gun that emits particles along it's path to fake bullets. Whenever I move the camera/character- the particles are misaligned, as well as anything else I try to modify ...
37 views

### Positioning of AABB / Rectangles

I am wondering what is the best way to position rectangles, the ways I have thought of are: Have an x and y at upper left, then have a width and height Have an x and y at upper left, and an x and y ...
118 views

### Why does my ship look like it's going backwards instead of fowards? [closed]

I'm making an Asteroids-clone based on this tutorial. I'm stuck on the 5th part of the tutorial. For some reason my ship is going backwards instead of forward or it looks like its going forward, but ...
86 views

### Mapping of positions on images in different frames

I am looking for a possibility to map different positions on a 2D Image which has different frames. Let's say I have an image, consisting of three frames, which shows a spaceship. The first frame ...
632 views

### Shuffle tiles position in the beginning of the game XNA Csharp

I'm trying to create a puzzle game where you move tiles to certain positions to make a whole image. I need help with randomizing the tiles start position so that they don't create the whole image at ...
133 views

### very simple math destination and speed calculation

My player goes to (destinationX, destinationY) His position is: (x,y) and the player has an update event function update() { this.x = this.x + dx; this.y = this.y + dy; } what is the formula ...
181 views

### How to calculate the position of an attached model after rotation?

I'm programming a basic game on XNA. I started to place an object (eg weapon) attached to the right arm of my player. When I move my character forward behind left or right all right. But when I ...
127 views

### which quarter of a triangle the point is in

I've got a world made out of squares. The square are devided in four triangles like this: The corners have their heights stored in a 2D array and the center height is the average of the corners. To ...
968 views

### OpenGL Reconstructing Position from Depth

I know this has been asked a lot of time before but none of those answers fixed my problem. I try to implement deferred shading and to do so I need to reconstruct the world space position from the ...
22 views

### Out of screen position to inner screen position

I don't know how I could solve this. I'm trying to accomplish this: So if a object is out of my screen I would like to calculate the position it would be inside of the screen. Searched already but ...
146 views

### How do I get a SphereCollider's global origin in Unity?

I've been following this tutorial: Understanding Steering Behaviors: Collision Avoidance but I'm having trouble implementing one of the functions correctly in Unity, here's the code: private ...
77 views

### 3d rotation of a Gunner unit to shoot the target

I'm developing a scenario to shoot incoming targets by a specific gunner unit, however I'm confused to actual logic of shooting an object with a gun. I'm working in 3D environment. I'v target's ...
80 views

### Angluar movement

I'm making a little game where you are a spaceship and you fly around in 2d using the A and D key to rotate and the W key to accelerate. Now my problem is if i turn my ship it doesn't go into the ...
2k views

### How to position two objects relative to each other

I am trying to make a modular vehicle editor similar to Kerbal Space Program. The user selects an initial vehicle part which is spawned in the center of the "work area". To add another part to the ...