This project is read-only.

Stacking object

Feb 15, 2013 at 3:32 PM
I've started using the excellent library but have now stumbled upon a problem I can't seem to solve by myself.

I'm trying to stack 12 drynamic objects on top of each other. But when I have about 8 or so the "tower" start to wiggle. I've tried changing the mass, RestitutionCoefficient and setting isBullet to different values.

Anyone got any tips to share to fix my problem? :)
I've thought about maybe creating joints when the objects are placed upon each other and then remove them when moving the object. But that sounds... A little bit too complicated for something I think can be easily fixed.

Any help much appriciated :)
Feb 15, 2013 at 4:01 PM
A few things to check and some ideas -

Are the objects blocks? (ShapeType=Rectangle)?

Did you try upping the Friction so that they don't "slip" ?

You could also try tweaking their AngularDamping and LinearDamping so they are less apt to move around.

Do you have a moving joint somewhere near your stack that is keeping the bodies from resting? Turn DebugMode="True" on your PhysicsCanvas and run your game. The blocks will ideally turn Red (not stay Green) which means they are resting.

For a sanity check, run the "Demo.Advanced" demo in the download and hit "Add Block" a whole bunch of times. This should give you an idea of how stacking blocks "should" normally behave.
Feb 15, 2013 at 4:46 PM
Edited Feb 15, 2013 at 5:03 PM
Thank you!
I've been doing some experimenting with the friction, and damping settings and it really helps :)
Thank you very much!

I'm using a special polygon actually, so not the nicest shape for physics :S

But 'sortof' works now, I'll be experimenting some more but I'ts way better then it's ever been during my 4 hours experimenting yesterday!