# Shoot bullet at moving object

from Red Blob Games
DRAFT

Background: After watching a @ShellSphinx’s GDC talk about projectiles (see slides [PDF]), @SquirrelTweets suggested an interactive diagram version.

Problem: you’re trying to a shoot a moving target. If you aim at where they are now, they’ll have moved. So you aim ahead of where they are. But your bullet takes longer to get there. Which means you need to aim even farther ahead. How do you calculate this?

{First diagram should show the problem. Try aiming at the target. Use animation to show where the bullet goes and whether it hits.}

{TODO: Change TIME from being a slider to ANGLE being the slider}
Time:
{{ status }}
WEIRD! The red line shows where the projectile would land at various .. times? I’m not sure really. Where it intersects the blue line is the place where your bullet would hit. It comes out of the equations but it’s not a shape I understand. I’ll try this again when I have an angle slider.

Note: I would’ve formulated this problem differently from the way it was presented at GDC. I think of this as cone-ray intersection; math is here and it might be useful to try that to see if I get the same answers as presented in the talk.