Rybadour / Spider-Fish

A simple Bullet Hell Shooter.
socr.uwindsor.ca/~giga
8 stars 4 forks source link

Perfect Circle-Circle Collision #11

Closed Rybadour closed 13 years ago

Rybadour commented 13 years ago

This task may prove to not be needed but if we find that circles are missing there collision because they are going too fast then this will be necessary. Why is this the case? In the simplest case collision is done frame by frame. So if two objects have moved through each other during a timestep but end up not colliding before and after the timestep, then the collision will remain undetected.

Article about the problem and a solution: http://compsci.ca/v3/viewtopic.php?t=14897 An Important equation from the article: http://individual.utoronto.ca/michael_lucarz/circle_collision_tutorial/eqtn3.png

I've committed an example I wrote in Javascript, in it I was able to simplify the equations using Wolfram Alpha.

erisco commented 13 years ago

I am aware of this issue but itw From: Salbris Sent: Monday, September 26, 2011 10:12 AM To: erisco Subject: [Spider-Fish] Perfect Circle-Circle Collision (#11) This task may prove to not be needed but if we find that circles are missing there collision because they are going too fast then this will be necessary. Why is this the case? In the simplest case collision is done frame by frame. So if two objects have moved through each other during a timestep but end up not colliding before and after the timestep, then the collision will remain undetected.

Article about the problem and a solution: http://compsci.ca/v3/viewtopic.php?t=14897 An Important equation from the article: http://individual.utoronto.ca/michael_lucarz/circle_collision_tutorial/eqtn3.png

I've committed an example I wrote in Javascript, in it I was able to simplify the equations using Wolfram Alpha.

Reply to this email directly or view it on GitHub: https://github.com/Salbris/Spider-Fish/issues/11

erisco commented 13 years ago

I am aware of this issue but it will not be a problem in our game given the speed and size of the bodies.

The solution is to use a priori collision detection: that is, to know when two objects will collide before it happens. With high body counts the calculations become expensive, which is not ideal for our game. From: Salbris Sent: Monday, September 26, 2011 10:12 AM To: erisco Subject: [Spider-Fish] Perfect Circle-Circle Collision (#11) This task may prove to not be needed but if we find that circles are missing there collision because they are going too fast then this will be necessary. Why is this the case? In the simplest case collision is done frame by frame. So if two objects have moved through each other during a timestep but end up not colliding before and after the timestep, then the collision will remain undetected.

Article about the problem and a solution: http://compsci.ca/v3/viewtopic.php?t=14897 An Important equation from the article: http://individual.utoronto.ca/michael_lucarz/circle_collision_tutorial/eqtn3.png

I've committed an example I wrote in Javascript, in it I was able to simplify the equations using Wolfram Alpha.

Reply to this email directly or view it on GitHub: https://github.com/Salbris/Spider-Fish/issues/11

Rybadour commented 13 years ago

Also, one optimization might be to represent the enemy bullets as vectors, or curves instead of solid body colliding objects. This way we can just move the bullets along the curves and calculate efficient collision quickly along the curve.

erisco commented 13 years ago

We can use points, but bounding rects are easy too.

About the vectors and curves: again I don't think such a collision detection method would be an optimization. If you would like to discuss an implementation I am available until 4. From: Salbris Sent: Monday, September 26, 2011 12:29 PM To: erisco Subject: Re: [Spider-Fish] Perfect Circle-Circle Collision (#11) Also, one optimization might be to represent the enemy bullets as vectors, or curves instead of solid body colliding objects. This way we can just move the bullets along the curves and calculate efficient collision quickly along the curve.

Reply to this email directly or view it on GitHub: https://github.com/Salbris/Spider-Fish/issues/11#issuecomment-2200175