0
votes

Alright, so I have dove in and understood how to do collisions between fast moving circles and basic curve/line based shapes. I have not yet wrapped my head around detecting the collisions between two moving circles. I have been modeling them as capsules and so while I could find their intersection points easily I am not sure how to resolve where one stopped and the other began.

Furthermore once I know that information I really don't know how to resolve their velocities and positions.

The situation is that there are acouple hundred little circles, quickly moving following the laws of physics. There are also much more massive circles that follow the position of the mouse/finger/touch as it moves and inherit the fingers velocity etc. The goal is that the little circles are hit off of the larger circles. This is tricky because the large circles wont react to the collision at all and most algorithms I can find require that.

How do I even begin to think about and resolve this type of collision scenario? Not only can I not figure out where the fast moving little circle collided with the fast moving large circle I have no idea how to factor in the finger velocity to properly collide the little circles off of it.

Any good ideas?

1
How fast is fast? It sounds very similar to what I did a couple of years ago. You might want to take a look.Nico Schertler
So the little circles will move no more than the large circles radius each frame. The fingers can move as fast as fingers do. That is a very well written article and that just might be it. Will follow back if not.J.Doe

1 Answers

1
votes

Let x1, y1, vx1, vy1 be x-position, y-position, x-velocity, and y-velocity of circle1. Similarly, we have x2, y2, vx2, vy2 for circle2.

Since one of the circle, say circle1, does not react to collision, it is useful to look at the collision from the perspective of this big guy (also called frame of reference). In this frame of reference, circle2 has the x-velocity of vx2 - vx1 and y-velocity of vy2 - vy1. The x- and y-position of circle2 is similarly x2 - x1 and y2 - y1.

In this frame of reference also, circle1 is not moving and can be treated as a static wall.

You can then treat this problem similar to that of a moving circle2 colliding against a wall at a normal vector of (x2-x1 , y2-y1) and velocity of (vx2-vx1 , vy2-vy1).

I'm assuming you know how to solve this, since you said you understood collisions between a circle and a shape.

Once you get the final velocity of circle2, just remember to go back to the original perspective by adding vx1 to the x-velocity and vy1 to the y-velocity.