Physics with no Rotation in Chipmunk?

BlitzMax Forums/Brucey's Modules/Physics with no Rotation in Chipmunk?

Rico(Posted 2008) [#1]
Hi! I've just downloaded ChipMunk, and got the demos up and running. I've had a brief look at them but don't really know much about the nuts and bolts of how they work (yet).
I wanted to acheive a specific look and feel to my game. Is it possible using Chipmunk - to have a load of boxes which can be stacked and pushed around ( a bit like the demos I suppose) BUT have them so they don't rotate AT ALL. (and so one box will not fall off another until the boxes bottom corner is no longer in contact with the box below - so no tipping). I know this isn't realistic physics but its the look I want for my game.
Thanks - I appreciate any help.

Rico.

P.S. Where can I find a Chipmunk Tutorial which explains everything with working examples. I hope there is one!


Rico(Posted 2008) [#2]
Hello. Can anyone help? Maybe with the tutorial at least?
Thank you.


Retimer(Posted 2008) [#3]
You might find some help here:

http://www.slembcke.net/forums/viewforum.php?f=1


Space_guy(Posted 2008) [#4]
For limiting rotation you should set the inertia to infinity on the boxes.
Im not sure if the effect is just like you want but it should be close enough to work with. Perhaps fool around abit with the surfacevelocity commands.


Armitage 1982(Posted 2008) [#5]
If you mind changing your physics engine, there is a SetFixedRotation method with Box2d. I've used it for my main character as infinite angular velocity isn't very effective.
There is also examples and extensive documentation.


Rico(Posted 2008) [#6]
-Thanks Retimer, nice to know there are some Chipmunk specific forums.
-I will try setting the inertia to infinity - when I code something, I haven't actually written anything yet in Chipmunk, I'm just wanted to find out what is possible first. Thanks Space_guy
-Armitage - I don't mind changing my physics engine. What is the difference between Box2D and Chipmunk - is one better than the other? does one perfom faster?

Thanks for all the help - it is appreciated! :)

Rico


Armitage 1982(Posted 2008) [#7]
Chipmunk and Farseer are Based on Box2D (the Lite version I thing).
All the mechanics behinds Chipmunk has been inspired by Erin Catto the developer of Box2D.

There is small differences between all of these 2D engine.
The performances are similar but Chipmunk tend to be easier to learn since there is less methods and functionalities.

There is still some little bugs in Chipmunk though !
For example stacking objects with restitution is very unstable at rest point.

Here is a little list of some nice point Box2d has to offer :
- Continuous Collision Detection (no more object passing through walls !!)
- Callback Collision
- Huge API
- True MKs unit simulation with scaling system
- Bouncy object stack correctly
- Manual/wiki/Community and a nice roadmap ! ( http://www.box2d.org/ )

At the moment the Max community is focused around chipmunk because thanks to Brucey the module is done, downloadable and just working.

But take a look at the Box2D Brucey SVN ( http://maxmods.googlecode.com/svn/trunk/box2d.mod/ ) and try what's best for you ;)


Rico(Posted 2008) [#8]
I really like the sound of Box 2D - especially the continous collision detection. Can I use Box 2d with my ordinary version of Blitz Max? Sorry to sound stupid - but what's SVN?

Thanks - Rico


Brucey(Posted 2008) [#9]
If SVN scares you, then you may want to wait a wee bit until I get around to making a proper release of it.
It's almost there...


Rico(Posted 2008) [#10]
Ok Thanks Brucey - We all really appreciate the hard work you do!

Will Box 2D be as fast, performance-wise as chipmunk? I was thinking maybe the continous collision checking may slow it a bit. Thanks again

Rico


Space_guy(Posted 2008) [#11]
Yes thank you Brucey. Really great work!


Brucey(Posted 2008) [#12]
Will Box 2D be as fast

I believe so, yes. I've found the bottleneck using both libraries tends to be BlitzMax rendering stuff to the screen, rather than the engine itself.

For CCD you only enable it for bodies which are likely to go fast enough to need it - like bullets. If your bodies don't move that fast you might never need to use it at all.
Static bodies don't get tested, and you can tweak the time non-moving bodies take to fall asleep too - so the engine is only processing the things it needs to.


Armitage 1982(Posted 2008) [#13]
To add a note on CCD:

Dynamic objects always use a CCD when collision happen with Static Shapes.
This is why there is practically no chance your object pass through your level. Even if your walls are very thin.

But be careful since there is a minimum thickness size (differences between 0 and 0.01 will crash Box2D).
It's sounds like it's small but Box2d is tweak to work well between 0.1 and 10 Meters (KMS units).

Values are scaled thanks to Brucey (look at render.bmx).