Dealing with poly shapes in bodies

Official forum for the Chipmunk2D Physics Library.
Post Reply
mwelch
Posts: 3
Joined: Wed Apr 28, 2010 9:27 am
Contact:

Dealing with poly shapes in bodies

Post by mwelch »

Hi. New to Chipmunk, and enjoying it so far. In my very limited experience, I've found a need for two things that I think would help:

1: A desktop application that would take a sprite image, let you trace an outline over it, and output a ready-made vertices array. Trying to calculate this stuff is tough!

2: The ability to make shapes opaque, for debugging purposes. It would be nice to confirm onscreen that a shape matches up pretty well to the sprite it's representing in Chipmunk.

Maybe tools like this exist already, or there are other, better ways of getting done what I'm trying to get done. If so, I'd love to hear about them!

Thanks,
Matt
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Dealing with poly shapes in bodies

Post by slembcke »

As far as an editor, I know some people have used SVG editors and parsed those out. For our games we usually just keep shapes simple or make a quick and dirty makeshift editor: http://howlingmoonsoftware.com/wordpress/?p=166

Depending on how many objects you have in your game, there are valid performance reasons to avoid using tight fitting polygons for each of your sprites. Polygons also must be convex, so you aren't gaining a lot by going more than 6 vertices or so anyway.

As far as drawing transparent shapes, if you are using the debug drawing code used in the demos then just modify it a bit. That's what we did in Twilight Golf. I just made a few tweaks to drawSpace.c so it only drew outlines and drew that over the final scene.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests