Rope simulation with solid objects

Please don't post Bullet support questions here, use the above forums instead.
Fexii
Posts: 1
Joined: Sun Apr 17, 2011 9:40 pm

Rope simulation with solid objects

Post by Fexii »

Hello! I'd like to start by saying that I haven't studied game physics formally, so my knowledge is from articles online that I can understand.

I am working on a 2D game that requires rope physics. To start, I have created a prototype with one end of the rope attached to the mouse pointer, and a large, heavy ball on the other end, with gravity acting upon everything.

For the simulation I use verlet integration, infinitely stiff springs, and iterative relaxation (http://www.xtremevbtalk.com/showthread.php?t=224429). To keep the rope's length, I have added constraints on the maximum length of every spring, as well as a constraint between each rope particle and the mouse pointer, and each rope particle and the heavy ball.

With just the rope swinging around in empty space, all of this works great.

The problem I'm having is trying to have the rope interact with collidable solid objects without breaking the constraints. The constraint solver and collision handler always seem to be at odds with each other. Either the rope constraints will be met by penetrating the object, or the collision constraints will be met by separating the rope particles beyond their maximum length.

Here are some things I've tried that haven't worked:

- Using continuous collision detection when solving the constraints so that particles can never penetrate
- Alternating between solving all of the constraints then solving all of the collisions within the relaxation loop
- Iterating through all of the particles and first handling the constraints on that particle, then handling the collisions on that particle

Some of these methods got close, but the real challenge is when the rope wraps around the object. In that case, the rope particles are trying to get closer to each other, while the collision is pushing them away from each other.

It seems like a solution could be for the collision response to not push the particles away from each other, but instead to push them along the colliding surface. I'm not convinced it will work though, and I'm unsure of which direction along the surface to push them.

Does anybody have ideas about how to manage the fight between the rope constraints and the collision constraints?