p2.js icon indicating copy to clipboard operation
p2.js copied to clipboard

Adding a sprite image to a collision body and adding physics when it reaches center canvas

Open courtneyvigo opened this issue 8 years ago • 1 comments

Hi all :) Im new to p2 and pixi. Im combining the two. I currently have a pixi sprite that is an image of a gem that moves across the canvas. Once it reaches center screen (250px), it will use p2 to make it fall into a cup, along with other objects that collide with each other.

currently, the code making the image is: color = new PIXI.Sprite(resources["https://res.cloudinary.com/dubyisimd/image/upload/v1481228417/red_f5iwah.png"].texture);

What is the correct way to link the pixi sprite to the physics engine?

Thank you!

courtneyvigo avatar Dec 14 '16 19:12 courtneyvigo

There is already a project that combines these two technologies specifically.

Located at phaser.io.

This should solve your use case.

Cheers, -Josh

jtenner avatar Dec 16 '16 18:12 jtenner