Good day everyone! New on here after lurking for a while, hoping to be able to learn a lot and contribute accordingly...
Straight to business. I'm implementing a simple'ish Rigid & Soft Body physics engine and I'm stuck on the soft body collision-physics part. I've implemented the soft body physics using Maciej's Pressure-Spring Model.
My engine is *very* simple:
while(1)
{
foreach(object in objectArray)
{
AddGravity;
AddForceFieldForce;
Integrate(dt = constant);
ClearAllForces;
UpdatePositionInOctree;
}
Collide
}
Right now my collision detection is nothing but a vertex-by-vertex test against a fixed wall. And here lies the problem - WHAT do I do when a collision does occur? Several options I've tested which just give unrealistic or unstable results:
- Measure penetration, set Vertex.Position to (Vertex.Position - Penetration), set Vertex.Velocity to Zero, add opposite force to Vertex.Forces.
- Measure penetration, set Vertex.Position to (Vertex.Position - Penetration), set Vertex.Velocity to (- Damping * Vertex.Velocity), don't touch forces.
...
I'm just completely swamped, any pointers in which direction I should be looking would be greatly appreciated. Articles, books, tutorials, sample code, keywords, anything...
Thanks!