Simple Projectile Physics

Blitz3D Forums/Blitz3D Programming/Simple Projectile Physics

Gabriel(Posted 2005) [#1]
I have all this stuff written down somewhere, but I think it all went up into the loft six months ago.

Taking a projectile at any given height and with any given velocity ( positive or negative ) I want to be able to find the new height after a period of time.

The only formula I could find from googling some projectile physics pages was this :

EndY=StartY+(VY*T)-(0.5*((Gravity*Time)^2))

But that doesn't look right to me, and a quick test indicates it's not returning the correct answer. Does someone have the correct formula?


Michael Reitzenstein(Posted 2005) [#2]
That's the correct formula.

s = ut * (1/2)at^2

Displacement = initial velocity * time + half of acceleration * time squared.

How did you do your 'quick test'? I'd bank on *that* being wrong.


slenkar(Posted 2005) [#3]
what kind of game are ye making syb?


Gabriel(Posted 2005) [#4]
That's the correct formula.

s = ut * (1/2)at^2

Displacement = initial velocity * time + half of acceleration * time squared.

How did you do your 'quick test'? I'd bank on *that* being wrong.


Ah yeah, thanks. That looks more like it. I had the brackets in the wrong place in my original post. ( It was squaring gravity multiplied by time instead of just squaring time. )

I think the test is ok. I'm just firing off projectiles continuously and then randomly picking a point at which to predict where the shell will be in 20 frames and then seeing if the prediction was right. It was always predicting too high.

what kind of game are ye making syb?


I'm not making a game exactly. Just thought it was about time I updated Tennis Babes a bit.


Berserker [swe](Posted 2005) [#5]
Hi all! Greetings from Sweden!

Maybe that would work for a "throwing parameter" directly translated from Swedidh, wich i need for my "Scorched Tanks"-clone. You know that old Amiga game wich sort of reminds you about the first "Worms" where theres tanks on different locations on a 2Dterrain.

I havent got it to work just yet allthough i have seen some mathematic calculations of it.

Also i have studied this in school a while ago, but you know how easy it is to forget.

Any Ideas?