Jump to content

PIXI + Planck (Box2D) demo


dacatchman
 Share

Recommended Posts

Added to https://github.com/pixijs/pixi.js/wiki/v5-Boilerplate

In this demo, you will see how to convert between box2d space and screen space.

I usually leave it like that: pixi objects have to be in pixels, physics in units. There's a way to notify box2d part that pixi changed something: like , if "obj.transform_localID" was changed -> need to update transform from pixi side. But multiplication/division there is needed anyway :) Treat it like properties: if you change pixiObj.position, its in pixels, if you change pixiObj.body - its in units.

Link to comment
Share on other sites

  • 2 weeks later...

Bumping because I updated this.  Mainly, a new live demo can be found here:

https://dacatchman.github.io/pixi-planckjs-demo/

 

Added toggles for bullet physics, interpolation, and the timestep tweaking.  Also, added triangle shapes so you can see how to roll custom shapes for Box2d.  Has more aggressive culling for timestep panic as well.

Future updates may include custom shape file loading from PhysicsEditor, I wrote a custom json exporter for it that works nicely with planck (well any box2d really) and PIXI.  Just depends how far along I keep pushing my personal projects.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...