Sign in to follow this  

Colliding two projectiles.

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]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this