Sign in to follow this  

stopping particles after collision

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

Ive managed to implement the verlet integration aspect of the Jacobsen paper but now Im stuck on the collision part. Ive got a function that checks line vs line and returns a boolean but not any more information than that. How can I make it so that if the particle/constraint hits another constraint, the particle doesnt go through it. The paper just mentions "collision engine" and how it find penetration points, but I dont have an engine yet. The game is 2D so hopefully it wont be too complicated. Should I be checking constraint vs constraint collisions or is there an easier way? thanks for any help

Share this post


Link to post
Share on other sites
You can do the line versus line test if you want but that may not look that great for many objects. Better to treat each rigid link as a collision object with some width. The easiest shape for a line is a swept circle in 2D like a capsule. The test for collision is very simple for this primitive.

If the distance from your test point to the closest position on the line is less than the width of the capsule, you have a collision. The collision normal is the vector from the test point to that nearest point.

This takes care of your end points. For link segments colliding, you would find the closest point between two line segments and test that. Same idea though.

Once you have a collision, you apply a small impulse to seperate the links. If it was linked rigid bodies, you would apply the impulse at the point of contact. For your particle method, you would probably be best to apply the impulse to the two connecting particles proportionally based on distance.

Share this post


Link to post
Share on other sites
Thanks for the help, I got it working. Sorry for the late reply, I didnt have the internet for a while.

Share this post


Link to post
Share on other sites
Sign in to follow this