The motion physics of the objects sailing through the air, ranging from thrown baseballs to battleship cannonfire to falling rocks.

learn more… | top users | synonyms

70
votes
15answers
13k views

How are bullets simulated in video games?

I have been playing games like MW2 recently and, as a programmer, I tend to ask myself how do they make the game so immersive. For example, how to they simulate bullet speed. When an NPC fires a ...
14
votes
5answers
2k views

How to calculate turn heading to a missile?

I have a missile that is shot from a ship at an angle, the missile then turns towards the target in an arc with a given turn radius. How do I determine the point on the arc when I need to start ...
12
votes
4answers
5k views

2D tower defense - A bullet to an enemy

I'm trying to find a good solution for a bullet to hit the enemy. The game is 2D tower defense, the tower is supposed to shoot a bullet and hit the enemy guaranteed. I tried this solution - ...
10
votes
2answers
531 views

How do I make good guy attacks only hit bad guys and vice versa?

My game has many different type of good guys and many different type of bad guys. They will all be firing projectiles at each other but I don't want any accidental collateral damage to occur for ...
9
votes
3answers
2k views

Projectile Motion - Arrow

In a 2D game, I simply want to draw the trajectory of an arrow in flight. With the code below, the trajectory (the parabola) looks right, but the angle (or rotation) or the arrow isn't. float g = ...
9
votes
4answers
939 views

What's the most efficient way to find the intersection point of a missile and a bitmap terrain?

Following up on my earlier question about finding the slope of a 2D bitmap terrain I now need to know the best way of finding the point on the 2D terrain that the missile hit. Obviously, I can see if ...
9
votes
1answer
1k views

Adding air drag to a golf ball trajectory equation

I'm developing a 2D golf game in VB.NET 2005, but I am stuck on how to implement air or wind drag that should affect the ball. Already I have these equations for projectile: Vo ...
9
votes
4answers
670 views

Calculating missile trajectory around orbits before shooting

I'm building a game with Unity3D. It's a Gravity Wars clone. Both player and AI turrets shoot missiles at each other (giving an Angle and a Power variables), trying not to crash missiles on planets. ...
7
votes
1answer
883 views

How to make an arrow land at a specific position in 3D world space

In my game when I click with the mouse on the terrain somewhere, I'd like the player to fire an arrow to that position in a parabolic fashion. The arrow has a position, acceleration and velocity all ...
6
votes
4answers
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 ...
6
votes
1answer
244 views

How do I change the speed of an object without changing path travelled?

I have a ball which is being thrown from one side of a 2D space to the other. The formula I am using for calculating the ball's position at any one point in time is: x = x0 + vx0*t y = y0 + vy0*t - ...
5
votes
2answers
4k views

How can I find a projectile's launch angle?

I am making a 2d game in which units fire arrows at each other. I know the shooter's and the target's position and the initial velocity of the projectile. I want to know the angle the projectile ...
5
votes
1answer
164 views

Tracing a 2d path through multiple gravity fields

For a projectile starting at origin O, an initial velocity V, and several stationary planets P[n], how would I pre-calculate and store the path it would take without actually stepping through each ...
4
votes
1answer
269 views

How to account for acceleration when aiming projectiles?

How do I aim a constant speed projectile to hit a target if there is a constant acceleration vector acting on it? (For example, the wind and gravity from Worms.)
4
votes
5answers
793 views

Trying to make a game with C++, using lists to store bullets and enemies, but they are not erased

I've been trying to make a pretty simple space shooter game with C++, and I have been having a lot of trouble trying to use lists to store enemies and bullets. Basically I followed the post here ...
4
votes
2answers
697 views

Tracking Object Position - Firing on a Trajectory

How can I calculate the position of an object after "firing" it from a fixed point? I am to create a small game - most likely with canvas (pure HTML, JS based) or Adobe Flash - in which the player ...
4
votes
1answer
909 views

Realistic Trajectory of a Projectile

When simulating an airplane and a missile, to get them moving in the air we apply a force in one direction. Now an airplane has wings that keeps it afloat while a missile can have fins to stabilize ...
3
votes
3answers
2k views

How do I calculate the exit vectors of colliding projectiles?

I'm trying to create projectiles which bounce/ricochet off one another when they collide in mid-air. All projectiles are spherical and have identical size, mass, and speed. Each has two vectors: one ...
3
votes
1answer
496 views

Maximum range of projectile fired at given force and elevation

I've gone over this again and again, and my result is obviously wrong when viewed in-action. Here's the initial formula I converted (first one): http://en.wikipedia.org/wiki/Range_of_a_projectile ...
3
votes
2answers
531 views

Discover x,y coordinates given set arc distance and rotation

I have a turn-based car simulation. My vehicles have a maximum speed they can travel in a round, as well as a maximum amount they can change their heading over the course of a round. Say, 20 meters ...
3
votes
3answers
327 views

Adding 'swerve' to a direction

I'm not much of a maths expert, so this is probably quite straight forward. I was playing a soccer flash game where you take free kicks. You provide Power, Swerve and Direction. I'm reading up on ...
3
votes
5answers
337 views

Forcing one projectile to follow close behind an initial projectile

I'm shooting out a projectile and I want another projectile to closely follow it. I can't simply shoot out the second projectile at a slightly lesser time because the first projectile may change ...
3
votes
1answer
96 views

What formula does this projectile velocity code derive from?

//Calculate the velocity needed to throw the object to the target at specified angle. float projectile_Velocity = target_Distance / (Mathf.Sin(2 * firingAngle * Mathf.Deg2Rad) / gravity); ...
2
votes
2answers
2k views

SDL Bullet Movement

I'm currently working on my first space shooter, and I'm in the process of making my ship shoot some bullets/lasers. Unfortunately, I'm having a hard time getting the bullets to fly vertically. I'm a ...
2
votes
2answers
848 views

Physic of an arrow in flight

What are the formulas which represent the horizontal and vertical displacement of an arrow in flight (as well as it angle)? I would like to make sure that I take into consideration the arrow's fluid ...
2
votes
1answer
1k views

Rotate image around a specified origin

I'm trying to rotate my Turret.png (small Gunhead with a laser in front) towards the mouses location on the screen. I tried just using my method for rotating projectiles towards the next step on their ...
2
votes
2answers
1k views

Find meeting point of 2 objects in 2D, knowing (constant) speed and slope

I have a gun which fires a projectile that has to hit an enemy. The problem is that the gun has to be automatic, i.e. - choose the angle in which it has to shoot, so that the projectile hits the enemy ...
2
votes
1answer
396 views

What units does Sprite Kit use for physics?

I'm developing a simple ball game in Sprite Kit. I need to predict the ball's trajectory, so I went back to my physics book for the equations for acceleration, time, speed and space. The problem is ...
2
votes
1answer
176 views

Calculating/Predicting a way

I'm just starting with physics, so I'm not always sure about what I'm doing. It's a 2D project but I'm using 3D physical objects like SphereCollider etc.. What I have: Objects floating in space and ...
2
votes
3answers
214 views

How can I determine trajectory from distance and time, without initial velocity?

I'm attempting to develop a Mortar that needs to lead it's shot to the target enemy. The shot will have a pre-determined constant flight time of (2.5 seconds) and it will have where the enemy should ...
2
votes
0answers
104 views

Initial direction of intersection between two moving vehicles? [duplicate]

Possible Duplicate: Predicting enemy position in order to have an object lead its target I'm working with a bit of projectile prediction for my AI and I'm looking for some ideas, any input? ...
2
votes
2answers
263 views

What is a technique for 2D ray-box intersection that is suitable for old console hardware?

I'm working on a Sega Genesis homebrew game (it has a 7mhz 68000 CPU). I'm looking for a way to find the intersection between a particle sprite and a background tile. Particles are represented as a ...
1
vote
1answer
274 views

Calculating projectile velocity from moving object

I'm working on a top down space shooter and am having trouble with calculating/understanding the physics for projectiles launched from the space ship. The ships have a velocity vector and a turret ...
1
vote
4answers
1k views

Solving for velocity in the x/y/z axes?

In a 3D environment I have an object with a displacement x that I know I need to traverse in a given time interval. I have the object's heading and elevation and I want to figure out the distance the ...
1
vote
1answer
314 views

How are trajectories calculated and transmitted to other players in Multi-Player?

I play alot of COD4. And can see tracers for gunfire, missles, care packages fall from helicopters etc. There is alot of activity. I am curious to know the algorithm (at a high level) that manages ...
1
vote
2answers
367 views

Simplified trajectory equation to identify Time Taken(t) by a protectile to travel Distance(d), under gravity?

I am building a game, where I have to plot a trajectory of a ball in 3D space, launched with an inital velocity Sx, Sy, Sz. [I am using OpenGL and Android-NDK] Lets assume Sz is always 0. And Sx ...
1
vote
1answer
366 views

Bullets and projectiles in component based entity systems

Currently one of my games engines written for a shooter seems to work correctly. Currently projectiles are sparse, travel quite slowly and are synced over network they are generated as entities. ...
1
vote
1answer
563 views

How make a laser path prediction line like a “slingshot cowboy” game?

How so I make a laser path prediction line like a “slingshot cowboy” game in cocos2d or box2d and select the target like "slingshot cowboy" game.
1
vote
0answers
641 views

Why are my Box2D bodies disappearing when they collide? [closed]

I have a Box2D simulation going on and a system that loads the bodies and its' shapes from a text file definition. I create a new physics world, i load bodies into it, from one of these files. ...
0
votes
1answer
310 views

How do I determine a good path for 2D artillery projectiles?

I'm building a little "tank wars" game (like this one). I understand the math, and I am able to define a parabola from the launcher to the objective I want to reach. The parabola depends on the ...
0
votes
2answers
237 views

How to know when a bullet has hit its destination in a game with a fixed timestep? [duplicate]

@James is wording my question better than I am, so I figured I'd put this here: I believe what you are asking is that you have a bullet moving in a game with a fixed timestep and that when the ...
0
votes
1answer
82 views

Physics / drag of object falling through atomsphere [closed]

Trying to simulate an object plunging into atmosphere. It seems to work, until the velocity falls past terminal velocity... down to zero... and then back up! Something must be wrong with how I am ...
0
votes
1answer
847 views

How to find which side of a collider has been hit from hit.normal?

In Unity3d, i can get the normal of the surface with which the collider collides using hit.normal, but is there a way to find which side has been hit what is provided bu Unity3d? One solution is to ...
0
votes
1answer
221 views

Aim at moving target (or predicting target's position at time it takes for projectile to hit it) [duplicate]

I have a game where I know the location and velocity of my target. I know my own location and the speed of my projectile. I want to determine either the location of the intersection between my ...
0
votes
2answers
539 views

Undeviating bullet in AndEngine

I'm looking for a bullet that can collide with other bodies of the world but doesn't change direction according to collisions. I want the bullet to perform the collisions but without changing its own ...
0
votes
0answers
28 views

2D Bullets / particles in parallax [on hold]

Parallax in 2d games is a method to create an illusion of depth. Sprites representing entities that are further away appear smaller and move more slowly. Sprites that are closer, appear bigger and ...
0
votes
0answers
65 views

Creating a arc path connecting two GameObjects in Unity

I am working on a game on a spherical surface which first of all is a big challenge in itself. I want to create a path on an arc which connects two points ( seen in the image ) and show an arc path ...
0
votes
0answers
15 views

Projectile Motion in lwjgl with java [duplicate]

I was trying to make a game with a bow and arrow using lwjgl but I couldent get the arch right. I have a function called projectile that is updated once a frame for each arrow. my frame cap is at 60 ...
-1
votes
2answers
558 views

Javascript - create a new bullet instance every time a user event is triggered

Basically I have a function that I need to create an object of every time the user presses space(event listeners not shown here). function arrow(){ this.x = playerXPos + 40; this.y = ...
-1
votes
1answer
145 views

Projectile motion based off angle

I was using this code to hit an object that is moving horizontally(from right to left) and player on the left is throwing bullets to hit the object.But, what I am finding difficult is projectile ...