How to add bezier curve in box2D

Discussion about using Moai SDK - post questions, bugs and issues here.

Moderators: seebs, franciscotufro

How to add bezier curve in box2D

Postby mankichi89 » Fri Jul 06, 2012 9:32 pm

Sorry for my "stupid" question but :
" How to add a bezier curve for box2d fixture " and
" What's the difference between 'addEdges' and 'addPolygons' "
mankichi89
 
Posts: 8
Joined: Mon Apr 23, 2012 10:30 pm

Re: How to add bezier curve in box2D

Postby bslayerw » Sat Jul 07, 2012 6:49 pm

Box2D does not support Bezier curves, you'd have to implement that yourself. AddPolygon is used to create a closed collision geometry polygon and is limited to 8 vertices (can be configured in the headers). AddEdges allows "infinite" polygons that don't have to be closed. You can used add edges to approximate bezier curves.

In the past I've used Inkscape to create illustrations of my collision geometry using straight paths and export that as SVG. I then convert the SVG to edges which I then call addEdges on.

Hope that helps.
User avatar
bslayerw
 
Posts: 29
Joined: Sat Oct 22, 2011 5:43 pm
Location: Seattle

Re: How to add bezier curve in box2D

Postby mankichi89 » Sun Jul 08, 2012 7:40 pm

Thks
mankichi89
 
Posts: 8
Joined: Mon Apr 23, 2012 10:30 pm

Re: How to add bezier curve in box2D

Postby ibisum » Mon Jul 09, 2012 1:28 am

bslayerw: I've also done some work with SVG-as-container-for-pipeline .. maybe we should do a wiki entry on such a subject, as I am sure your SVGPath->addEdges work is interesting, and I'm almost positive we could solve the SVG projection/coordinates system once, for all benefit? Anyway I think this is something that could definitely be of interest, and I would like to contribute as well .. I'll put it on my personal moai-todo, but its getting longer the more I type, heh heh ..
;
--
ibisum@gmail.com
Got a MOAI snippet? Please consider adding it to http://moaisnippets.info
User avatar
ibisum
 
Posts: 1005
Joined: Mon Oct 17, 2011 1:11 am
Location: Vienna, Austria


Return to Moai SDK

Who is online

Users browsing this forum: No registered users and 0 guests

x