- #1
Tipx
- 6
- 0
Hi,
Like a lot of people programming, I created a simplistic 2D collision engine. This engine handles the collisions of circles (I know I typed "disc" in the title, but I wanted to avoid replies like "circles don't really exist so they can't collide".)
The simulation is friction-less, so since the circles do not rotate initially, they never end up rotating. The collisions are also totally elastic and since there is no deformation, the collisions happen instantly. The detection model is an a-priori model. I want my engine to handles circles that expand or shrink.
It works fine with regular ("regular", opposed to "expanding" or "shrinking") circles, but when it comes to non-regular circles, I'm having an issue :
I can detect when the collision will occur, but I have no clues how to calculate the movement of the circles after the collision. I can't base the impact forces on the velocity of the circles since it's possible for 2 non-moving circles to collide if one (or both) of them expands.
I thought about taking into account the "radius growth speed" into the velocity, but that's just a wild guess. Anyone can steer me in the right direction?
Thanks,
Xavier
Like a lot of people programming, I created a simplistic 2D collision engine. This engine handles the collisions of circles (I know I typed "disc" in the title, but I wanted to avoid replies like "circles don't really exist so they can't collide".)
The simulation is friction-less, so since the circles do not rotate initially, they never end up rotating. The collisions are also totally elastic and since there is no deformation, the collisions happen instantly. The detection model is an a-priori model. I want my engine to handles circles that expand or shrink.
It works fine with regular ("regular", opposed to "expanding" or "shrinking") circles, but when it comes to non-regular circles, I'm having an issue :
I can detect when the collision will occur, but I have no clues how to calculate the movement of the circles after the collision. I can't base the impact forces on the velocity of the circles since it's possible for 2 non-moving circles to collide if one (or both) of them expands.
I thought about taking into account the "radius growth speed" into the velocity, but that's just a wild guess. Anyone can steer me in the right direction?
Thanks,
Xavier