p2.js
p2.js copied to clipboard
Adding a sprite image to a collision body and adding physics when it reaches center canvas
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!
There is already a project that combines these two technologies specifically.
Located at phaser.io.
This should solve your use case.
Cheers, -Josh