Page 1 of 1
[Solved] Suitable values (jumpy and exploding simulation)
Posted: Sat Feb 02, 2008 1:28 pm
by Kingdom Of Fish
Hi, I'm kind of curious on whats recommended values for simulations? I'm currently using 1000 constraint iterations and 4 steps each frame (framerate is about 60) and it's still jumpy and explodes once in a while. The world I'm using is 800x600 grav: 98.1 damp 0.9 i have two bodies 4 verices each and 3 segments around the bottom half of the screen. Friction on all bodies are between 0.5 and 1.0. Is there any other value that could be messing things up?
Re: Suitable values
Posted: Sat Feb 02, 2008 3:23 pm
by slembcke

Woah. Something is amiss there for sure. I generally use 10-20 iterations and 1 or 2 substeps. Can you expand upon what you are doing?
Re: Suitable values
Posted: Sat Feb 02, 2008 5:25 pm
by Kingdom Of Fish
I've currently just set up a scene to construct my xml and resource loading classes so I just have the scene as in my first post. I'll try to show what happens with different values.
Re: Suitable values
Posted: Sat Feb 02, 2008 6:56 pm
by Kingdom Of Fish
http://video.google.com/videoplay?docid ... 8083999422 - This one works more or less as it should with 100 constraint iterataions and 4 steps per frame. This setup earlier resultet in spastic behaviour of the top square.
http://video.google.com/videoplay?docid ... 7012395270 - This one is 100 iterations and 2 steps, notice the cubes tilting at the end.
http://video.google.com/videoplay?docid ... 9914953129 - This shows the real problem, 10 iterations and 4 steps.
Re: Suitable values
Posted: Mon Feb 04, 2008 6:05 am
by supertommy
Wow. That looks pretty weird. I've made the same "falling boxes" application myself, and I've always seen good results with whatever the default values are.
In my experience, whenever things are really messed up, I double-check that my time-step is not too small. If I have a simple application with no frame-rate limiter, the time-steps may approach zero, which can have some unpredictable effects.
If you suspect that this is your problem, try to put a sleep for a few milliseconds somewhere in your main loop.
Re: Suitable values
Posted: Mon Feb 04, 2008 7:27 pm
by Kingdom Of Fish
Well, I've recoded the entire app (not because of this, but because I just made some wrong turns waaay back) and now it works... the problem was that I sat the inertia manually with (what i thought) suitable values... like 100 on a 100x100 cube with a mass of 10. Having done some inertia caluculations now I realise how silly it was and I'm feeling really ashamed of this thread all together
But thanks for your help.
Re: [Solved] Suitable values (jumpy and exploding simulation)
Posted: Tue Feb 05, 2008 12:20 am
by slembcke
Heh. that's a common one. I was actually thinking that might be it.
Re: [Solved] Suitable values (jumpy and exploding simulation)
Posted: Wed Feb 06, 2008 8:06 pm
by Kingdom Of Fish
slembcke wrote:Heh. that's a common one. I was actually thinking that might be it.
Well its a valueable lesson learned