# Colliding two projectiles.

This topic is 3033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

My current project involves firing bullets and such at things. I thought it would be great if I could figure out a way to collide two projectiles moving straight in one direction. The problem is that math hates me. I ended up starting with: x1 + cos(a1) * v1 = x2 + cos(a2) * v2 Same thing for y. Got the v2s by themselves, set the two equal to each other, and ended up with: a2 = Atan2(y1 + sin(a) * v1 - y2, x1 + cos(a) * v1 - x2) This is clearly incorrect - nowhere is the second projectiles velocity taken into account. However, and this is the fun part, it DOES work to an extent. It will get me an angle I might guess at, in the right quadrant, and in general seems to work except for a small error. Im guessing that error is that the y part of Atan2 requires a v2 instead of a v1; however, my math completely eliminated v2's, and Im not quite sure how I would derive this equation without eliminating something. Anyone have a solution? [Edited by - Mooglefrooglian on March 30, 2010 4:27:26 PM]

1. 1
Rutin
26
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 10
• 9
• 9
• 9
• 46
• ### Forum Statistics

• Total Topics
631751
• Total Posts
3002077
×