Search the Community
Showing results for tags 'collides'.
-
Hi there I'm learning up on how P2 collision groups work and I have a question. It seems that if I have two collision groups, one for the player and one for platforms, to get the two to interact I have to write: this.ground.body.collides(playerCollisionGroup);this.player.body.collides(groundCollisionGroup);If I just use one of those statements the collisions don't work, I have to use both. This seems a little strange - if ground is set to collide with player, why do I also have to set the player to collide with ground? It seems a little redundant. Is there a reason it has to be bound twice? Rich is a heck of a lot smarter than me so I assume I'm just missing a very good reason for this Cheers!
-
Hi all, I have some issues with CollisionGroups ( I used to use them for ImpactEvents and am starting to wonder if there are not made just for that) I'll try to make it short and clear : Let's take two collision groups : var playerGroup = game.physics.p2.createCollisionGroup();var groundGroup = game.physics.p2.createCollisionGroup();Now let's take two sprites (assume they are created and physics is enabled) and set their collision groups: player.body.setCollisionGroup(playerGroup);ground.body.setCollisionGroup(groundGroup);With that if I want to enable collisions between these two sprites, I have to do this : player.body.collides(groundGroup);ground.body.collides(playerGroup);So here is the issue : if I put just one of these line, nothing happens. Isn't it enough to tell one body or the other to collide? It seems redundant to me. If that's the way it is, I'll deal with it, but I want to be sure I'm not making any mistake here Thanks
-
In version 1.1.6 it was possible to use overlap in collisions. There is something similar in the physics system p2? Now I use to define collision the "collides" function: collides (group, callback, callbackContext, shape) The problem is that the player can walk over enemies for example.