ambidex Posted November 7, 2014 Share Posted November 7, 2014 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:How can you build up complex bodies? What is the best approach? 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? Quote Link to comment Share on other sites More sharing options...
ambidex Posted November 7, 2014 Author Share Posted November 7, 2014 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. Quote Link to comment Share on other sites More sharing options...
ambidex Posted November 21, 2014 Author Share Posted November 21, 2014 Just picked up on this issue on my app again, still hitting the wall here... Filed a issue, might have a go at enhancing debugdraw myself, though I'm afraid I do not have enough knowhow about the P2.js internals to get that working. Quote Link to comment Share on other sites More sharing options...
ambidex Posted December 18, 2014 Author Share Posted December 18, 2014 Apparently I did figure out how to get it working. I've added extra support for some missing functions in debugdraw for p2.js. Also, fromPolygon now works appropriately with debugdraw. Awaiting review and acceptance for that pull request. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.