Stacking stability

Official forum for the Chipmunk2D Physics Library.
Post Reply
hero
Posts: 7
Joined: Sun Nov 07, 2010 7:03 am
Contact:

Stacking stability

Post by hero »

Hello once more,

I have been playing around with stacks of boxes, and found that starting at an amount of roughly ten boxes stacked vertically, things start to get unstable without further influences of forces except gravity.

My setup is the following:
  • A constant step/delta time of 15 (tried with 10 as well)
  • 10 iterations (played around with too)
  • Vertical gravity of 200
  • Tested with quadrates of the sizes 8, 16, 32 and 64
  • Tested by stacking them exactly on top of another at the beginning, and with an initial spacing
As said, things get unstable to the point where towers "wobble" into destruction by themselves quickly.

Is this a problem of Chipmunk, or am I doing something wrong? If yes, how can I solve this problem?

I'd also have another small question:

I have noticed that even when having two exactly ident stacks of boxes, not even close to another and created at the same time, they behave differently as they become unstable without any influences except gravity. Why is that?

Thanks in advance,
Hero
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Stacking stability

Post by slembcke »

hero wrote:A constant step/delta time of 15 (tried with 10 as well)
I'm guessing that is your problem. Do you mean you are doing cpSpaceStep(space, 1.0/15.0)? That is a really large timestep, 1/10 is even bigger. I would rarely recommend anything larger than 1/60. The actual value is dependent on the amount of gravity. Higher gravity means things accelerate faster and the solver has to work harder to fix the velocities. Using a timestep of 1/120 should work quite well for you. As for iterations, I would suggest 20 for a stack that size.

The sizes of the boxes shouldn't actually matter.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
hero
Posts: 7
Joined: Sun Nov 07, 2010 7:03 am
Contact:

Re: Stacking stability

Post by hero »

slembcke wrote:
hero wrote:A constant step/delta time of 15 (tried with 10 as well)
I'm guessing that is your problem. Do you mean you are doing cpSpaceStep(space, 1.0/15.0)? That is a really large timestep, 1/10 is even bigger. I would rarely recommend anything larger than 1/60. The actual value is dependent on the amount of gravity. Higher gravity means things accelerate faster and the solver has to work harder to fix the velocities. Using a timestep of 1/120 should work quite well for you. As for iterations, I would suggest 20 for a stack that size.

The sizes of the boxes shouldn't actually matter.
Ah sorry, I was unclear with that. My time step wasn't actually 15, but 15/1000.0f, so 15 ms delta time

I will try with 20 iterations as soon as possible

Thanks for your reply
aisman
Posts: 145
Joined: Tue Mar 04, 2008 2:21 am
Contact:

Re: Stacking stability

Post by aisman »

hero wrote:My time step wasn't actually 15, but 15/1000.0f, so 15 ms delta time
15/1000 = 1/66.6667

Why not using: 1/60 ? (16.6 ms)
Chipmunk4PB: The fastest way to write games together with PureBasic and the Chipmunk physics engine.
hero
Posts: 7
Joined: Sun Nov 07, 2010 7:03 am
Contact:

Re: Stacking stability

Post by hero »

aisman wrote:
hero wrote:My time step wasn't actually 15, but 15/1000.0f, so 15 ms delta time
15/1000 = 1/66.6667

Why not using: 1/60 ? (16.6 ms)
Where do you see the problem in using 15/1000?

I do it that way because my abstraction uses MS as type for the physics step counting, internally
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests