Originally Posted By: DavidLancaster

Thanks heaps for your help. If anyone has a working formula for this code please let me know. It's the same as getting an ai enemy missile launcher to fire at the position the player is moving to.


You're welcome. But can you tell us where the different approaches failed? Did you try them all? I know my first code was horrifying (not to mention that it actually was no code at all), but the math looks right to me. So why did it fail?

The same goes for all other approaches mentioned here. (I don't know about the content of your PMs, but if there was a solution given, it would surely help others with similar problems if you gave at least basic details as to its content, because I, for one, am totally lost now.)

 Originally Posted By: DavidLancaster
I've been tweaking it for ages, test all your code. As I can calculate the position of the ball if I know the time variable, I transition the time from a variable 1-500 frames, calculate the soccor ball's position, once I have that position I calculate where the player will be if they run to that position, I then use vec_dist to compare the distance and once I find the spot which has the smallest distance from the player to ball then I store the time variable and compare it to the other players on the field.


Sounds like a clever approach. I guess the problem is that for every "t", a different player will be closest to the ball, but you cannot tell this way for which "t" the player will get it (and there may be unlucky cases in which the "smallest distance t" will give you the "longest really-getting-there t". Plus, are you just calculating it once for "t=500frames from now", or are you actually calculating it five hundred times? If so, then my formula may not be so bad after all ;\)

EDIT: Ah, so there was a second page already! I didn't really understand your approach, Gumbydon22 (Thats an awesome name right there), so it will be interesting to see diagrams that may help to get it in my head \:\)


.....
Is it even real soccer? or is it futuristic soccer with weapons, or maybe MAGICAL soccer? Oh, yes. Magical games. I used to play those.

Last edited by Error014; 04/09/08 18:38. Reason: Post by Gumbydon!!!11

Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!