new Jiglib physics version

Post Reply
Guest

new Jiglib physics version

Post by Guest »

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!"
melax

That is most excellent

Post by melax »

Runs nice and fast on my computer.

Nice, It looks like you even bumpmapped the boxes.

I poked my head into the source code in jiggle0.0.19 and I was so pleasantly impressed by how clean and good it looked. There's an intelligent breakdown into modules, correct naming of classes and functions, and all the algorithms, data representations, and equations of motion/collision stand out nicely instead of being obfuscated. Where's the spagetti code and the bloatware?
melax

Re: That is most excellent

Post by melax »

melax wrote: Where's the spagetti code ?
oops, i accidently clicked submit before explaining that last statement.


Often demos dont include source, and in those rare cases when they do, there isn't always an effort toward cleaning up and organizing the source.
Something i've been guilty of at times :-) I can think of samples or demos that i've written in the past, where I didn't take the time to clean up the source and other people had to wade through unused code and incorrect function names wasting time trying to figure out how it actually worked.


So I was complimenting your code on being quite clean and readable.


again thanks
lolito
Posts: 3
Joined: Sat Jan 28, 2006 9:07 am

Post by lolito »

Great works !!!:D

thank you for explanations about your works



I have a lot of work to reach the quality of your library !! :roll:


Thank you for your help :wink:

(and sorry for my bad english.. )
Post Reply