Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 Re: Help Me ! » projectile question for a game » 2007-08-17 10:44:59

Yeah, I understand that the discriminant must be non-negative and thus non-imaginary in order to hit the target.  But even when I can hit the target (I'm in range), if the target is higher than the launch point, the bullet is too short. If the target is lower than the launch point, the bullet will overshoot.  If the bullet is level with the launch point, it's perfect. 

Shouldn't it work even if the target is not level with the launch point?  If not, what will?

#2 Re: Help Me ! » projectile question for a game » 2007-08-17 08:22:16

Thanks JaneFairfax for your help!

I was under the same impression to what you are saying.  I found something similar to what you said on wikipedia:
http://en.wikipedia.org/wiki/Trajectory_of_a_projectile

I found it under "Angle theta required to hit a coordinate (x,y)".

I've attached their resulting equation to this post, they suggest that it can hit an arbitrary point x,y that isn't level with the launch point.
This seemed perfect, so I tried it out.

My results are that this still only works when the target is level with the launch point.  If I raise the target up, the projectile is too short, if I lower it below the launch point, it goes too far.  If I'm level with my target, it hits dead on.  Do you think there is something I'm missing?

#3 Help Me ! » projectile question for a game » 2007-08-17 07:17:47

HeroInteractive
Replies: 6

Hi!  I'm a flash game developer, check out some of my games at herointeractive.com!

I'm working on a new game, and a problem has come up that I simply haven't been able to find an answer to!

The problem is this:

If I have a cannon that launches a projectile at location 0,0 on a cartesian coordinate system, and that particle is fired with a velocity v and is subject to gravity g, what is the angle theta that is needed in order to hit target x,y.  In particular, if the target is at a different height than the launch point.

I've tried some equations that have worked if the target's y location is that of the launch point, but they won't work if it is different.  I can control g and v and all that good stuff, I don't need to find x or y, what I need is theta, the angle to rotate my gun to, in order to hit a location x, y.

Can anyone please help me?

Board footer

Powered by FluxBB