Jump to content

Phaser P2 Kinematic Collisions


Recommended Posts

Hi All

I have spend all night trying to figure this out. I changed my game from Arcade to P2 physics and can not for the life of me get collisions to work. I changed my body types to Kinematic since I don't need any physics applied to my object. Below is my code :


createEnemies: function() {

         var enemy = enemies.getFirstExists(false);
        if (enemy) {
                enemy.reset(500, this.game.world.height);
                enemy.body.kinematic = true;
                enemy.body.velocity.y = -100;
				enemy.anchor.setTo(0.5, 0.5);
				enemy.body.moves = true;
                enemy.body.debug = true;
                enemy.body.data.shapes[0].sensor = true;
                enemy.body.onBeginContact.add(blockHit, this); // DOES NOT TRIGGER
                //enemy.body.collides(bulletsCollisionGroup, hitEnemy, this); // DOES NOT TRIGGER



If I change my body from Kinematic = true, to Kinematic = false, then all the events trigger. Any ideas?

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