Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i use physics (Box2d) with Pixi #2262

Closed
sorawa opened this issue Dec 24, 2015 · 10 comments
Closed

How can i use physics (Box2d) with Pixi #2262

sorawa opened this issue Dec 24, 2015 · 10 comments

Comments

@sorawa
Copy link

sorawa commented Dec 24, 2015

Can you give me the link to the totorials
thank you

@ivanpopelyshev
Copy link
Collaborator

Sorry for late answer.

I had my own box2d + debug renderer for pixi somewhere. I'll find it and post a demo in the examples.

@ivanpopelyshev
Copy link
Collaborator

I hope that you already bought https://www.codeandweb.com/physicseditor , its difficult to make box2d in pixi without it

@englercj
Copy link
Member

englercj commented Jan 3, 2016

Basic idea is to spawn bodies for sprites and keep the two scenes in sync with eachother.

@andrevenancio
Copy link
Contributor

I'm using box2d(web) and pixi.js on a project... there's nothing to it.
an array of bodies added to the world (box2d)
an array of sprites added to the stage (pixi.js)

your render function checks the position and rotation of the box2d bodies, and applies it to the sprites array. let me know if you need a code example

@GoodBoyDigital
Copy link
Member

closing as seems answered 👍

@mspanish
Copy link

@ivanpopelyshev I just want to add collision and bouncing around to a few shapes (rectangle, triangle, circle) - which can be dragged and dropped onto a correct answer sprite. Is box2d the best solution for that? Does anybody have an actual code sample? I can download the physics editor app if necessary too.

@andrewstart
Copy link
Contributor

For just the basic shapes, you shouldn't need the PhysicsEditor app. I've used p2 successfully on mobile in EaselJS for about 10 or so of those same 3 shapes, and it worked out okay.

@mspanish
Copy link

thanks p2 has some really nice looking samples - I'll try integrating one of them with my sprites - seems this shouldn't take much to accomplish - shame I can't find an updated physics plugin/bridge for PIxi though.

@crazyyi
Copy link

crazyyi commented Apr 7, 2017

@mspanish You can try this library: https://github.com/shakiba/planck.js. It is ported from Box2D.
You can also try Matter.js, which is also a very good library. You can even find tutorials on Youtube.

@lock
Copy link

lock bot commented Feb 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants