BreezySparrow Posted May 7, 2017 Share Posted May 7, 2017 Hello, I recently converted a game I was making into P2 physics, only to find none of my objects are colliding with the world boundaries. Since I need the player objects to collide with the world boundaries, I attempted to create a collision group: var playerCollideGroup = this.physics.p2.createCollisionGroup(); <define all player objects details> this.physics.p2.updateBoundsCollisionGroup(); this.player.body.setCollisionGroup(playerCollideGroup); this.board.body.setCollisionGroup(playerCollideGroup); However my player objects are still not colliding with world boundaries. Is there something I am missing? EDIT: So I reviewed the code I had been using based in this thread; it appears that making my player body static (this.player.body.static=true;) was the issue. However as indicated by the CodePen examples in that thread I reliant on the body to be static for proper rotation of objects around the player. What can I do to have the player still collide with world bounds while still remaining static-like in movement? Link to comment Share on other sites More sharing options...
samid737 Posted May 8, 2017 Share Posted May 8, 2017 Hi you could try to set the mass of your object to a very high number (more mass--> tougher to move an object). In the codepen examples it would be something like: pivotpoint.body.mass=1000000; But it might be that you have to apply more force/ add higher velocities to move your player around in the world, so you have to take that into account. Link to comment Share on other sites More sharing options...
Recommended Posts