Jump to content

Complex collision bodies (p2.js plugin)


ambidex
 Share

Recommended Posts

For reasons I can't even remember myself anymore, I'm using the p2.js plugin as physics engine. I've used some collision bodies which work perfectly, though at this point I need to create some "complex" bodies. I could build the body up with rectangles and circles, though I'd prefer adding these as a point based vector body. Though I'm totally in the dark which would be the best way to approach this, Google did not seem to be my friend on this question. Examples of complex collisions are scarce. 

 

Summarizing my questions:

  1. How can you build up complex bodies? What is the best approach? 
  2. Do you need to create game.Body()'s for each shape you use? Or is it possible to add multiple shapes to one body (.addShape()), this did not seem to work for me? 
Link to comment
Share on other sites

Just found out about the "fromPolygon()" function at p2.Body(); though, I'm not entirely sure if this plays nicely with Panda.js? Just tried it out, though it seems like it doesn't do anything? Debugdraw doesn't show the shape and also on the position it should be, it doesn't collide. 

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

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...