chipmunk vs. programmer

BlitzMax Forums/Brucey's Modules/chipmunk vs. programmer

Rick_72(Posted 2010) [#1]
Have just discovered what an excellent module this one is. Pretty good work!

But I don't know why this one doesn't work as expected. Have a look at this piece of code (it's actually Brucey's demo1; I have only changed the falling box to a randomly generated asteroid rock thing):



The falling rock ignores any collisions with the steps. Why's that? Can anyone help with this?

Thank you guys..


Rick_72(Posted 2010) [#2]
Oh goddamn it. It's so simple and stupid. One has to define the vertices of a polygon clockwise! Just as it is said in the manual.

OK, READ first, then START.


Rick_72(Posted 2010) [#3]
Wow, a polygon has to be convex. So I have to split my rocks into parts (lines) and joint these later on. Sounds a bit complex.

Does anybody have a spimple solution for concave bodies?


Warpy(Posted 2010) [#4]
You could use this code to split a concave polygon into triangles.


Armitage 1982(Posted 2010) [#5]
I was using chipmunks at the very beginning but it's only the little brother of Box2D. Maybe you could check this last module too ?

I know there is also a good code repository about automatic concave transformation code on the official website. The Blitzmax box2d module is a bit outdated now but anyway still more complete than chipmunks ! There is a lot of things I wouldn't be able to achieve if I had stick to Chipmunks. But I admit Box2d is a little bit harder to understand (but not that much different really).

A good solution would be to build the asteroid object from several convex polygons shapes mixed and overlapped together in order to create the illusion of concave form. Plus you could erase every polygons one at time (if required) or completely rebuild smaller one this way. Both engine are fast enough to create/erase in real time multiple complex forms.

Hope this help.


Rick_72(Posted 2010) [#6]
@Warpy: that looks pretty cool! Thanks.

@Armitage 1982: Box2D looks pretty interesting. I will have a look at it. The manual looks good so it should be easy to find out the basics.

Thanks!


Chroma(Posted 2011) [#7]
One has to define the vertices of a polygon clockwise! Just as it is said in the manual.
Actually, you define them counter-clockwise. I just tested it.


Oddball(Posted 2011) [#8]
I guess that all depends on whether you class the positive y axis as pointing up or down. Inverting the y axis will reverse all rotational directions.


Chroma(Posted 2011) [#9]
Well, everyone is making the points around 0,0. I've tried it clockwise and counterclockwise. Clockwise, the object shows up draw correctly but the collisions do not work. Counterclockwise, everything works normal. And I noticed other people plot their points counterclockwise too.

And assuming that all Y axis on a computer is positive downwards. Maybe it was how the mod was converted? At any rate, Chipmunk rocks.

Last edited 2011


Vampire(Posted 2013) [#10]
Where is the manual of Chipmunk module BTW?