Page 1 of 1

Polygon explosion

Posted: Sat Jul 13, 2013 7:06 am
by memmaker650
I'm newbie with Chipmunk physics and want to make an easy example of polygon explosion.

I started with the SmashLogo demo but in this example the are no explosions, only so much ball movements.
I know how to do polygon collision but my dude is for example how to explode a cube into many little pieces.

Re: Polygon explosion

Posted: Sat Jul 13, 2013 12:24 pm
by slembcke
So I have a demo of that in the vanilla C code too actually:
https://github.com/slembcke/Chipmunk2D/ ... /Shatter.c

It splits a polygon into voronoi regions similarly to how you'd implement grid based Worley noise. It's not commented well unfortunately. I could try and give you some pointers if you wanted to use it though. Try it out in the demos and see if that's what you think you want.

Re: Polygon explosion

Posted: Tue Jul 16, 2013 4:59 am
by memmaker650
slembcke wrote:So I have a demo of that in the vanilla C code too actually:
https://github.com/slembcke/Chipmunk2D/ ... /Shatter.c

It splits a polygon into voronoi regions similarly to how you'd implement grid based Worley noise. It's not commented well unfortunately. I could try and give you some pointers if you wanted to use it though. Try it out in the demos and see if that's what you think you want.
Thanks, i will try your code and post here the part of the code which define the 'explosion'.

Re: Polygon explosion

Posted: Tue Jul 16, 2013 6:37 am
by memmaker650
Really nice example.

I will customize the tank demo using the SmashLogo demo for the bullet and the Shatter Demo to apply the explosion/destruction to create a custom demo to show a fire&destroy chipmunk example.

But i'm surprised, the Shatter demo is new. I worked with Chipmunk 6.1.4 and I don't have any Shatter.c file. Nice to see new demos. Good work.

Thanks slembcke.