# Projectile Formula

## Recommended Posts

I'm creating a weird "tanks" game in which the users have a bird's eye view of the battle plane(straight down), I've included angle and power to determine where the player's shots would "land", however I don't know how to calculate the distance of the shot.

Being a bird's eye view, I don't need to draw out tracers or arches, but I just need to know how to use angle & power to determine the distance from the "tank"...My 8th grade knowledge of math isn't getting me far either.

Can anyone help me?

This probably is in the wrong section... sorry... but it is an autoit game, if that's worth anything...

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

##### Share on other sites

I'm creating a weird "tanks" game in which the users have a bird's eye view of the battle plane(straight down), I've included angle and power to determine where the player's shots would "land", however I don't know how to calculate the distance of the shot.

Being a bird's eye view, I don't need to draw out tracers or arches, but I just need to know how to use angle & power to determine the distance from the "tank"...My 8th grade knowledge of math isn't getting me far either.

Can anyone help me?

This probably is in the wrong section... sorry... but it is an autoit game, if that's worth anything...

Ballistic formulas, including examples of usage: hyperphysics.phy-astr.gsu.edu

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
##### Share on other sites

It's not really that easy if you don't know anything about physics/maths. You can't determine the distance that the projectile traveled if you don't have a coordinate system, initial speed (Vertical and horizontal or vectorial values), initial angle,initial height, etc. A projectile describes a parabolic(?) trajectory which can be divided in two: vertical (constant speed) and horizontal (variable speed).

This would be the formula if you neglect air resistance:

d=((v.cosA)/g).{v.sinA+[(v.sinA)^2 + 2.g.y]^(1/2)}

(don't get scared by that, should be simple with autoit with a good use of parenthesis and having all the needed info)

Where:

d: distance (in meters if you take g in m/s^2)

v: initial speed (in m/s, if you take g in m/s^2)

A: initial angle (radians or degrees)

g: gravitational acceleration (here we take 9.81 m/s^2)

y: initial height (in meters if you take g in m/s^2)

here's a drawing i made for this situation:

If your projectile will be launched from the ground (y=0 initial height equal 0) then the formula is a lot simpler:

d=[(v^2)/g].sin(2.A)

like this:

Assuming that your "tank" is at (0,0) in your coordinate system, you can use this last formula to make things easier.

-edit-

Damn PsaltyDS Took me quite a while to do that... you could tell I was bored.

Edited by Nahuel

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...