# Tagged Questions

The tag has no usage guidance.

145 views

### 2D Physics: storing previous position vs storing velocity

I saw a number of 2d game tutorials and books where previous position of an object was stored in state instead of velocity vector. Velocity is then calculated each frame as a difference between ...
1k views

### How can I draw a line of certain length and direction?

I want to create a line of certain length and direction. What I mean by this is drawing a line from Point A to Point B. Normally in Unity C# to draw a line from Point A to Point B is simply: Debug....
114 views

### How do I set angular velocity/torque so that it's pointing to velocity/direction?

Right now, when I spawn a shootable object, it goes like this: Because I just set it's angle to this: float aimAngle = (float) Math.atan2(velocity.y, velocity.x); bullet.setBodyAngle(aimAngle); ...
5k views

### How to smoothly rotate a vector in a direction?

I'm looking for an easy way to achieve the following: Object A, B { Vector2D position; Vector2D orientation; } update(elapsed) { //rotate A's orientation in B's direction by x * elapsed ...
429 views

### How do I find the 2D direction to a 3D location?

I'm writing a 3D space flightsim, and I'm trying to display a 2D arrow on screen that points to the player's selected target. To clarify, the arrow needs to point in the direction that the player has ...
2k views

### Determining if something is on the right or left side of an object?

I have a character in a 3D world which is facing an arbitrary direction on a flat plane, the player can click on the left or right side of the character and based on which side is clicked on a ...
521 views

### How to get direction and velocity of movement of an object dragged with the mouse in Unty (C#)

I have an object that is dragged by the mouse (X and Z positions) over a table, with the following simple code: Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if(Physics.Raycast(ray, ...
360 views

### Calculate turn rate between xy and target xy on a moving sprite with variable speed

My First question on here so be kind... I am writing an aerodrome simulator in as2, I need to calculate a turn rate between 2 points so that the aircraft turns nicely. I have tried a few things but ...
59 views

### Collision resolution when moving in two directions

I am making a bomberman clone and I'm having problems regarding moving on both x and y axis (pressing down+left, down+right, up+left). Here is a video to demonstrate the problem. I use Tiled for the ...
497 views

### How do I detect a tile map collision's direction? [duplicate]

I'm implementing collision detection with the map for my platformer. I have a method that generates a polygon on every tile and checks if the player hits it -- that's all fine. The problem is that ...
78 views

### How can I move an object in a direction other than the ordinals?

I want to move a game object from its current position to the mouse position, but my current code only ever moves in one of the eight ordinal directions. In other words, I want it to move along the ...
933 views

I'm trying to implement shadow mapping to my engine. I started with directional lights because they seemed to be the easiest one, but I was wrong :) I have implemented deferred shading and I retrieve ...
86 views

### How to make an enemy projectile head to the player's position with constant speed

How can I dynamically set the movement speed of the X and Y of the projectile so that it moves at a constant speed when the projectile heads at the player's position? I know this has something to do ...
740 views

### Making Ball Fling in a Curve Direction

I was wondering how to figuring out how to slice a ball (banana kick) by flinging it curve-ways. However, according to the LibGDX's gesture listener, the method for flinging only focuses on a straight ...
142 views

### How to know from which direction there is a collision with an object? In Unity C#

In the game, there is a ball, and moving objects that can hit it. I want the ball to move when an object hits it. But the ball should move to the right direction, the one which the collision was from. ...
287 views

### Correct way/How to think to plan out “control/animation flow”?

So basically, a problem I've had in past attempt at making games (little playing around with stuff): how to do a correct, non-sloppy way of planning the flow of animations/control? Let's take an ...
120 views

### Why do characters only move in 4/8 directions in top games? [closed]

In many top down games, like Zelda (4 directions) There are only 4 or 8 possible directions. Why is this? Is it a design choice or a technology limitation? I can't think of any reason that even ...
615 views

### How to translate a direction on the screen to 3D space?

EDIT: Alright, I've figured out what's wrong. I'm calculating the direction vector properly with the below code: //Get our ship position in screen space Vector3 shipPos = Camera.main....
293 views

### How can I calculate force and acceleration?

I have problem of calculating the movement of the object. At the moment, I have a vectors calculated from the center of the screen minus the position of the object. direction vector = centerScreen -...
68 views

### How does this math behind converting angles to vectors work?

I calculated the vectors of my yaw and pitch successfully. Even tho it works fine, I can't seem to understand how the math works exactly. Could someone (graphically / demonstratively) explain me this ...
48 views

### Velocity Relative To A Vector

So I have a velocity vector b in world space and I have a "pointing" vector a in world space. I need to know how to make the velocity vector to be relative to the "pointing" vector. Better explanation ...
9 views

### cocos2d-x Label Set Custom Direction manually

sorry for my english... i am using cocos2d-x for developing an android -ios game... can i set custom right-to-left or left-to-right direction to my Label manually? i mean that i want to set it like ...
42 views

### Detect which direction an object collides with another

so I am trying to implement a collision detection system. I'm only using rectangles, so it's not too complicated. My collision detection currently does detect if the 'player' object intersects the '...
348 views

### Collision Direction Detection

I'm making an RPG game where players and enemies can collide with walls. Right now it pushes the player off the wall when he tries to 'go through' it. However, I detect which way he should be pushed ...
1k views

### Unity - Invert Movement Direction

I am currently developing a 2,5D Sidescroller in Unity (just starting to get to know it). Right now I added a turn-script to have my character face the appropriate direction of movement, though ...
73 views

### How to determine the best approximate direction [duplicate]

I want to determine which sprite to use when one agent is "facing" another agent. My game is 2d, and uses 8-directional movement. Deciding which sprite to use for movement is easy enough since there ...