mafiaflysoft Posted December 30, 2016 Report Share Posted December 30, 2016 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.fixedRotation=true; 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.scale.set(scaleRate); 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? 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.