new Jiglib physics version
Posted: Wed Sep 07, 2005 9:22 am
From gamedev.net:
"I promised b34r I'd post a new demo of my physics stuff - so
http://www.rowlhouse.co.uk/jiglib
None of the demos use a shock step, so consequently they actually feel a little bit slower than my previous demo versions. The reason they don't use it (and this is quite amusing) - it only worked quite nicely before because it had a bug in it, and now I fixed the bug it produces significant artifacts! I want to fix it properly...
You can configure the demos by modifying the config files - if you want to play around or if they run too slowly on your machine.
Anyway, I made a whole load of changes. See the readme.txt for how to use the demo. The significant changes to the algorithm are these:
1. During collision detection penetration depth is recorded at each point - but the penetration depth (PD) is calculated (in some cases estimated) for the beginning of the collision sweep. This means that during a collision -ve penetration depths get recorded. Also, the position gets recorded relative to the positions of the objects at the beginning of the collision sweep.
2. collision/contact impulses all get applied to the objects in the position they were at the beginning of the step.
3. If PD > 0 then an extra term is added to the impulse calculation to make the penetration relax to 0 over a number of timesteps.
4. If PD < 0 and the elasticity = 0 (actually, that's not quite the criterion I use, but anyway...), then an extra term is added to the impulse calculation to make the penetration relax to 0 over a number (1) of timesteps - i.e. using the same code as in 3.
What this means is that if there is an inelastic collision between an object and the world between T and T + dt then:
1. at time T an impulse gets applied that slows the object down just enough so that at time T + dt it will be touching the world.
2. at time T + dt another impulse gets applied that brings the object to a complete stop.
So - no more objects stopping short of the ground when they fall, etc.
Lots more to do to make it useful - at the very least I need to refactor the collision system (currently you can't have composites of different primitives, which is a really dumb thing!), and b34r demonstrated how excellent contact caching can be. I'm anticipating this will solve the drift that you can see in the walls - apart from the drift there's very little jitter.
Edit: Yes, I know the ragdoll's limbs separate from his body if you pick him up and swing him around hard, but then I say the same would happen to you!"
"I promised b34r I'd post a new demo of my physics stuff - so
http://www.rowlhouse.co.uk/jiglib
None of the demos use a shock step, so consequently they actually feel a little bit slower than my previous demo versions. The reason they don't use it (and this is quite amusing) - it only worked quite nicely before because it had a bug in it, and now I fixed the bug it produces significant artifacts! I want to fix it properly...
You can configure the demos by modifying the config files - if you want to play around or if they run too slowly on your machine.
Anyway, I made a whole load of changes. See the readme.txt for how to use the demo. The significant changes to the algorithm are these:
1. During collision detection penetration depth is recorded at each point - but the penetration depth (PD) is calculated (in some cases estimated) for the beginning of the collision sweep. This means that during a collision -ve penetration depths get recorded. Also, the position gets recorded relative to the positions of the objects at the beginning of the collision sweep.
2. collision/contact impulses all get applied to the objects in the position they were at the beginning of the step.
3. If PD > 0 then an extra term is added to the impulse calculation to make the penetration relax to 0 over a number of timesteps.
4. If PD < 0 and the elasticity = 0 (actually, that's not quite the criterion I use, but anyway...), then an extra term is added to the impulse calculation to make the penetration relax to 0 over a number (1) of timesteps - i.e. using the same code as in 3.
What this means is that if there is an inelastic collision between an object and the world between T and T + dt then:
1. at time T an impulse gets applied that slows the object down just enough so that at time T + dt it will be touching the world.
2. at time T + dt another impulse gets applied that brings the object to a complete stop.
So - no more objects stopping short of the ground when they fall, etc.
Lots more to do to make it useful - at the very least I need to refactor the collision system (currently you can't have composites of different primitives, which is a really dumb thing!), and b34r demonstrated how excellent contact caching can be. I'm anticipating this will solve the drift that you can see in the walls - apart from the drift there's very little jitter.
Edit: Yes, I know the ragdoll's limbs separate from his body if you pick him up and swing him around hard, but then I say the same would happen to you!"