[Solved] Suitable values (jumpy and exploding simulation)

Official forum for the Chipmunk2D Physics Library.
Post Reply
Kingdom Of Fish
Posts: 21
Joined: Sun Jan 27, 2008 10:56 am
Contact:

[Solved] Suitable values (jumpy and exploding simulation)

Post 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?
Last edited by Kingdom Of Fish on Mon Feb 04, 2008 7:27 pm, edited 1 time in total.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Suitable values

Post by slembcke »

:shock: 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?
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Kingdom Of Fish
Posts: 21
Joined: Sun Jan 27, 2008 10:56 am
Contact:

Re: Suitable values

Post 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.
Kingdom Of Fish
Posts: 21
Joined: Sun Jan 27, 2008 10:56 am
Contact:

Re: Suitable values

Post 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.
supertommy
Posts: 56
Joined: Tue Sep 11, 2007 2:30 pm
Contact:

Re: Suitable values

Post 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.
Kingdom Of Fish
Posts: 21
Joined: Sun Jan 27, 2008 10:56 am
Contact:

Re: Suitable values

Post 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 :P

But thanks for your help.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: [Solved] Suitable values (jumpy and exploding simulation)

Post by slembcke »

Heh. that's a common one. I was actually thinking that might be it.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Kingdom Of Fish
Posts: 21
Joined: Sun Jan 27, 2008 10:56 am
Contact:

Re: [Solved] Suitable values (jumpy and exploding simulation)

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests