Jump to content
  • Advertisement
Sign in to follow this  
unknownProdigy

2D movements between objects.

This topic is 4999 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

I'm having trouble understanding how to deal with movings objects that are going at different speeds. Sometimes the speeds of objects are much greater than others, so how do I deal with knowing the exact point of impact between objects especially if they are moving in different angles. This is in 2D.

Share this post


Link to post
Share on other sites
Advertisement
Given two line equations (the support for your objects trajectories, regardless of the actual magnitude of their velocities), you can compute the intersection point. It's a simple system of affine equations. Once you have that point, you can compute the time at which each object reaches it (divide the distance to that point by the object's actual velocity). If the objects reach the intersection at the same time, you have a collision.

If the objects aren't points, the system gets a bit more complicated (you have to compute the actual object-object distance as a function of time and find the minimum), but the basic idea goes along similar lines.

Share this post


Link to post
Share on other sites
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!