javascript - box2d-js element with external image -


so far in samples of varies box2d js implementation can find element defined in shapes (ball/box/etc), there way create element defined image, e.g. boulder?

you can use b2polydef , b2polyshape objects create polygons.

this documentation meant as3 relatively simple figure out javascript equivalent.

if wanted automate mapping image's bounding box polygon, use canvas , getimagedata() seek through pixels looking non transparent (assuming image has transparent background). more effort worth though.

also see understanding custom polygons in box2d.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -