Jump to content
  • Advertisement
Sign in to follow this  
Mooglefrooglian

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.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!