Jump to content

Phaser 2.6.2 colliding with two objects from separate parent groups?


Recommended Posts

Hey I've been trying to use Arcade Physics in order to do collision between two objects.   I set the two objects physics using:


where physics base is a sprite in a whole list of children in a group object with collision enabled. I made a class the extended group in order to contain references to specific children. I made two of these objects and tried to do the following:

this.boat1.physicsBody.onCollide = new Phaser.Signal();
this.boat1.physicsBody.onCollide.add(hitCollision, this);

I do this for only one group object (though this should still work?) 

after that in update I do 

this.game.physics.arcade.collide(this.boat1.physicsBody, this.boat2.physicsBody);

and then set hit collision to 

function hitCollision(boat1, boat2){

however I see no "hit" string in the log, indeed nothing shows up at all when the objects are clearly overlapped. 

I'm not sure how to actually get collision enabled, and how to actually move the two entities when hitting each other, apparently body.mass is used in imparting momentum, but I don't see how to make sure that momentum is imparted (unless bounce is what it is talking about?) 


Link to comment
Share on other sites

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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...