giving something back to the Flash community

vectorization v1

Tags: , , , , , ,

/! highly unstable experiments below! /!

so here’s an experiment using Box2D as an output for vectorized outlines.
what it does is it uses the previous post’s vectorize function, collects and renders the patches.
then when we click on a patch, it triangulates the simplified shape and includes it in a Box2D scene.
before you click beware:
it is very expensive CPU-wise + it may crash with complex objects.

You can click on the shapes above. then play around with them
I’ve locked some shapes that would be too big and cause the player to crash.

so we can already have lots of fun!

yet the funniest is probably the one below:

draw somethign then push the add to simulation button ^^
( rather draw small separated elements )
the good thing is that it can handle both concave and convex objects so that even if you draw a line, it will be included in the simulation :)

source code is so dirty I’m really ashame, I noticed there’s also a problem in the previous VectorShape class (in a getter).
I’ll try to clean up and fix soon.

enjoy :)

edit:on the previous article, Sakri left a comment saying he had ‘something in his sleeve’ :) somehow I knew it would be cool, little did I know it would be that cool ! great job!
I also atempted to implement the verlet integration to get flubby shapes, I couldn’t get it to work. he did :)

Tags: , , , , , ,

© 2009 HIDIHO!. All Rights Reserved.

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