# mesquishy

Member

1

122 Neutral

• Rank
Newbie
1. ## Need help with determing an equation to solve a typical 2d game problem.

Hi everyone, I have been thinking about the types of problems I would have to solve for simple 2d game situation. Hopefully someone here could point me in the right direction on how to solve this. I am only trying to solve this in terms of a 2D game world: An object T (I've been considering it as a point thus far) is moving at a constant velocity on a constant vector (slope, whatever). Another, computer controlled, stationary object B is attempting to "shoot" T with a projectile (also a point). This projectile travels at its own constant velocity. In order to do this, B must predict where T will be in such a way that the projectile and T will occupy the same location at the same time in order to "hit" T. I can think of ways to do this iteratively, but thats not how I think it could be done if I only knew the proper math. So if anyone out there can tell me how to determine this I would be most grateful! Has this been asked and coded a million times? Is there a free API that solves this I could use? Thanks everyone. EDIT: forgot the title. EDIT #2: Clarification: Object B is not considered to be moving at the time it shoots. The projectile it shoots has its own speed which is constant when fired. EDIT #3: More Clarification. The current speed and direction is known to B. i.e. B can see T moving and will make his "shot" based on T's speed and direction. (and thank you for both responses so far!!) [Edited by - mesquishy on March 30, 2005 2:55:49 PM]