Basic Block Physics

BlitzMax Forums/BlitzMax Programming/Basic Block Physics

Rico(Posted 2008) [#1]
Hello! I hope some on can help. I want to write a system where I can have any number of square (or rectangular) blocks on the screen. They can any x velocity and any y velocity. I want to have gravity going on. If you can imagine - you are looking at the blocks from the side - not the top.
You can do anything with the blocks you want. So for instance you could stack a load up in a pyramid and then if you pushed the bottom left block you would push all the other blocks in its way (and some of the one on top would move too).
I can work out the collision functions but not really the best way of pushing the blocks and making them 'slide' over each other. Does anyone know the nest way to implement this?

Thank you - Rico


xlsior(Posted 2008) [#2]
There are some physics modules available for BlitzMax that support what you want to do.

For example, Brucey's Chipmunk module: http://code.google.com/p/maxmods/


Jesse(Posted 2008) [#3]
The kind of sample you want is a bit complicated to explain in a forum thread And is a bit too complicated for most beginners(not saying you are or not). There have been several code projects posted by several programmers that some what work. you can find some in the code archives that deal with rigid body phisics. But nothing really high quality, just something to get started. Brucey converted the Chipmunk phisics library to BlitzMax it should do what you want and more. Again it's a bit complicated for beginners but with a little patience one can learn to use it.

Personally, I would use Chipmunk as it is too compicated to start a phisics engine myself. And why reinvent the wheel?


Rico(Posted 2008) [#4]
Thank you for the help. I reckon I can bodge together a basic physics system - things are going quite well so far. I'm not really writing a 'physics' based game as such - I really only need 'arcade' physics.
I will take a look at chipmunk. My main worry is that it won't be flexible enough, but instead just a general system (but I haven't looked at it yet, so it could be just what I'm looking for)

Does anyone know what the usual technique is for determining which side of a rectangle you've hit? (or even the corner) (when you've previously detected a collision between 2 rectangles). I've got a system but I think its a bit long winded, so I'd be grateful for any help.

Thanks - Rico