• Create Account

# rayp

Member Since 12 May 2009
Offline Last Active Feb 15 2013 04:49 PM

### In Topic: *Signed* distance between two moving lines

15 February 2013 - 12:48 PM

What is the signed distance between 2 lines? Lines are in a sense infinitely skinny. They are either touching, d = 0, or not touching d > 0.

### In Topic: Soft body physics

03 February 2013 - 11:24 PM

I have some experience doing soft body physics. I would say there is 2 main ways to do it.

1. The easy way. Make a particle physics engine. Add in some kind of forces or constraints to hold the particles together. You can use simple spring like forces. You can also model it using constraints, although  you might want to "soften up" the constraints. For example you might apply only 90% of the constraint impulse of a completely rigid constraint . Or for example a distance constraint, instead of being a fixed distance

C(x1, x2) = |x2-x1|-L= 0

You can define your constraint as being in some distance interval

C(x1, x2) = ||x2-x1|-L| < k/2

Then it is just a matter of making a bunch of particles and adding in the appropriate constraints. For example cloth might resist stretching and shear forces, while hair might resist stretching and bending.

This way is very easy and straight forward. Probably the hardest part is collision detection, since a body can intersect itself if it is soft.

2. The hard way. Use finite element analysis. Calculate the stresses and the strains on some volume ( usually a tetrahedron ) to calculate how it deforms over time. This is orders of magnitude harder than method 1.

I think in game programming the first method is pretty much the go to method.

"Is it important to have a rigid body simulation engine running before you attempt soft body physics, or are they largely independent?"[/size]

Soft body and rigid body physics will share a ton of code and use many of the same ideas. Studying either will will help you implement the other.

If you have not done any soft body stuff, I recommend you make a mass spring system, and experiment with that a little bit. Mass spring is about as simple as it gets and there is a ton of resources on the internet. Just google it. If you know a bit of calculus and vector maths you can have one up in running, from scratch, in a hour or so.

PARTNERS