View Single Post
  #5  
Old August 17th, 2007, 02:29 AM
Jack Simth's Avatar

Jack Simth Jack Simth is offline
Major General
 
Join Date: Oct 2002
Posts: 2,174
Thanks: 0
Thanked 0 Times in 0 Posts
Jack Simth is on a distinguished road
Default Re: OT: Looking for a good physics site

Quote:
narf poit chez BOOM said:
Tankee! Tankee very much!

...But, um, if the enemy acceleration needs to be chosen to use the formula and the formula tells it in which direction to accelerate and thus, how much to accelerate...

...Isn't that a closed loop?

Nope. You have a second, identical equation for the other dimension (or more - it's extendable to as many as you like; most games will use two (X, Y), some will use three (X, Y, Z) but you can have 30 if you feel like it), and you'll have a relationship between the two based on the overall max acceleration for the pursuer (based on the pythagorean therom; max acceleration = sqrt(a(x)^2 + a(y)^2 + a(z)^2 + ... ) and the persuer is picking an acceleration in the x, y, z, ... axises (axen? axes? - what's the plural of axis?); you'll end up with a system of equations, based on how much you're simulating.

It's simultaneous equations. If you've got four variables and three equations that relate them, you can usually solve for everything in terms of a single variable.
Quote:
narf poit chez BOOM said:

/me goes off to see what happens if /me uses that by inputing '0' for the enemy acceleration.

...Uh, the first one is the pursuer, right?

Whichever you'd prefer; the exact choice is completely immaterial. Math's like that, sometimes.
Quote:
narf poit chez BOOM said:

...'+/-'?
The Quadratic formula gives two results. One will usually give you negative time, which you discard. Occasionally it will come back with an imaginary number (by way of the square root of a negative) - in which case, interception is not possible.

Oh, and there's a REASON most games use flat velocities, rather than accelerations.

The simple way to do it, if you're going a little bit at a time anyway, is to simply accelerate in the direction of the target. The computer will have some overshooting issues, and it won't be the most efficient course, but it'll do the job eventually.
__________________
Of course, by the time I finish this post, it will already be obsolete. C'est la vie.
Reply With Quote