HIDIHO!

flash and you and me and you

  • Author: nicoptere
  • Published: Feb 28th, 2009
  • Category: AS3
  • Comments: 3

concave polygon > box2D

Tags: , , , , , ,

cover

now here’s a little demo of what the ear cutting algorithm can do


to use a shape inside Box2D it has to be convex.
the ggod thing with triangles is that they are convex.
and the good thing with triangulation is that it turns a concave object into a series of convex objects….
still following ?
right ! this is the purpose of the ear cutting algorithm :)

which means that you can start integrating (easily) free shapes into Box2D which is good news :D
now here’s a (not that ground breaking) demo to show the thing with one of the shapes from the other article:
a free shape in the box2D physics engine
Ok, so first, there are still atrefacts due to the weakness of the shapes (some balls can penetrate the shape). That comes from the triangulation which is not homogeneous enough. I’m thinking of a more clever algorithm to do that.

Second I probaly misunderstood something on how to configure the restitution factor of the bodies… or maybe the balls are too small… maybe you should try the bulletMode too …. well there might be something to fix between the keyboard and the chair.

Third, the amount of shapes has to stay very low ( I tried it with the horse model and the player crashed badly). I know there’s a limit to the number of the shapes you can create within a body. I should check that some day.

And Fourth, triangle is not the best shape, actually by default you can create an 8 vertices shape and if change some Box2D classes, you can go up to 64 vertices per shape( which is too heavy for the engine, trust me I tried). so next step is to find a better way to chop the poly.

Anyway as such, it can be nice to use for a terrain or a landscape because creating such a complex object out of boxes might be a real hassle ;)
have fun :)

Tags: , , , , , ,

3 Responses to “concave polygon > box2D”


  1. sitron
    on Mar 2nd, 2009
    @ 10:13 am

    oops!
    where has the swf gone? only seeing a big white space.
    or am i missing something?


  2. nicoptere
    on Mar 2nd, 2009
    @ 11:55 am

    hi,
    strange, it seems to work properly on both MAC(opera) & PC (FF3)
    it’s a SWFObj though…
    well anyway here’s a link to a html page:
    http://en.nicoptere.net/wp-content/uploads/2009/02/freeshape.html

    and if ever it doesn’t work then here’s the link to the swf itself:
    http://en.nicoptere.net/wp-content/uploads/2009/02/freeshape.swf

    hope it’ll work this time :)


  3. James Mugford
    on May 14th, 2009
    @ 10:36 pm

    I was wondering an application for the flicky pen strips (along the top of the form elements). Shame it’s so difficult to transfer our dexterity into AS3 apps

Leave a Reply

© 2009 HIDIHO!. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.