Hello, everyone
I would like to create 2D platformer game using playcanvas + p2.js
First , I follow this tutorial to active p2 world
but I find a problem…
I added p2box and p2body to the sprite and run the game
the p2box width and body height is not correct
here is my project
https://playcanvas.com/editor/project/668721
any idea??? Thank you
1 Like
Hi @supsersuperman,
It isn’t easy to work with p2 with the current implementation, since there isn’t a way to show the collision shapes. This is a good feature request, if you like submit it in the playcanvas-p2.js repo.
To fix your issue what I would do is, on the idle p2 body, change the width/height to match the size of the sprite:
And on the platform update the height property, it gets easier to find the correct values when you start implementing controls:
You can take a look at this tutorial as well, it’s a bit old but uses the playcanvas-p2 integration library:
3 Likes
really thx
Thank you very much, It works fine now!
2 Likes