Need help with the Physics of my simple game
Ok,I am trying to write a little game based on Ballistic Trajectorys and need to keep track of time. Here is my problem. I don't know how long it will take for the shot once fired to hit ground zero? So wouldn't I need to take the shot fire it with some know fps of the ammo and calculate the amount of distance it will travel in x amount of seconds? I am confused on how this should work. I have tried using this V*t*cos(angle) and that don't work to well.I am rusty on my trig but their has to be a better way to calculate a distance and how long it took to reach a point than this function. Also I want to keep track of the bullets path at any given time I need to know the height from ground zero at any given time. I am looking to do a game like Schorched Earth? Just a simple artillery game. Any help would be appreciated. Thanks
Windows 98/SE/ME SUCKS!
Deal with it!
if(windows crashes)
run Linux
else
yea right!!
RESIST WINDOWS XP!!!!!!!!!!
RESIST .NET TECH!!!!!!!!!!!
Edited by - MARS_999 on May 16, 2001 12:55:22 PM
Note: the description below is not optimized at all, just the matematical equation
To find ballistic trajectory, all you need to use is the angle and initial velocity
x velocity = total velocity * cos (angle)
y velocity = total velocity * sin (angle)
new y velocity = y velocity + acceleration * time
x velocity should stay constant (except for air resistance)
when y velocity = 0, projectile is at the apex of the flight
if fired from ground level, time when y velocity = 0 can simply be doubled to find when projectile hits the ground
y position = y velocity * change in time + last y position
x position = x velocity * change in time + last x position
with those, you should be able to make a passable projectile calculation game. Hope that helps you out
-Hyren
"Back to the code mines... ka-chink... ka-chink..."
vidgamez.iwarp.com
To find ballistic trajectory, all you need to use is the angle and initial velocity
x velocity = total velocity * cos (angle)
y velocity = total velocity * sin (angle)
new y velocity = y velocity + acceleration * time
x velocity should stay constant (except for air resistance)
when y velocity = 0, projectile is at the apex of the flight
if fired from ground level, time when y velocity = 0 can simply be doubled to find when projectile hits the ground
y position = y velocity * change in time + last y position
x position = x velocity * change in time + last x position
with those, you should be able to make a passable projectile calculation game. Hope that helps you out
-Hyren
"Back to the code mines... ka-chink... ka-chink..."
vidgamez.iwarp.com
"Back to the code mines... ka-chink... ka-chink..."Tachyon Digital - Down for the summer, be back in the fall.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement