dimanche 29 mars 2015

bounding polygon of a sprite from pixi to p2

I am importing a sprite into PIXI using



var texture= PIXI.Texture.fromImage("img.png");
var sprite = new PIXI.Sprite(texture);
// I set the position
stage.addChild(sprite);


I want to detect collisions on this sprite and since PIXI has no collision detection support. I am using p2.js and this needs a polygon bounding box for collision detection


How can I get the polygon from pixi and pass it to p2 and detect a collision?


Any sample or some pointers will be very helpful.


Aucun commentaire:

Enregistrer un commentaire