- #1

Hi!

As a part of a subject project I'm developing a game. It is a kind of real-time strategy game where two teams of tanks have to destroy each other (not very original, but interesting enough).

I have come across a problem I cannot solve: applying parabollic shooting to simulate their bullets.

I use the typical formulas:

x=x0+vx*t

vx=v0*cos(a)

y=y0+vy*t-0.5*g*(t)^2

vy=v0*sin(a)

where a=alpha, g=gravity (9.8 default) and v0=initial velocity modulus

What happens is that I had always used these formulas to calculate some typical things like: maximum height reached, ending x, etc.

But now, given an initial point, a final point and an initial velocity, I need to calculate the alpha that would take the bullet the minimum time.

I need to have a function f(t), to minimize it to know the minimum time and then get the alpha. But I always get struck in the depths of the calculus.

Can anybody help me, please? Thank you.

As a part of a subject project I'm developing a game. It is a kind of real-time strategy game where two teams of tanks have to destroy each other (not very original, but interesting enough).

I have come across a problem I cannot solve: applying parabollic shooting to simulate their bullets.

I use the typical formulas:

x=x0+vx*t

vx=v0*cos(a)

y=y0+vy*t-0.5*g*(t)^2

vy=v0*sin(a)

where a=alpha, g=gravity (9.8 default) and v0=initial velocity modulus

What happens is that I had always used these formulas to calculate some typical things like: maximum height reached, ending x, etc.

But now, given an initial point, a final point and an initial velocity, I need to calculate the alpha that would take the bullet the minimum time.

I need to have a function f(t), to minimize it to know the minimum time and then get the alpha. But I always get struck in the depths of the calculus.

Can anybody help me, please? Thank you.

Last edited by a moderator: