warpig Posted March 25, 2018 Share Posted March 25, 2018 Hi guys, I've been digging through the code, examples and the forums and I'm yet to discover a solution to my problem. I have an array of objects and have set their collision properties as follows: this.physics.add.overlap(this.ball, this.bricks, this.hitBrick, null, this); What I need is to be able to dynamically change the collision type to something like: this.physics.add.collider(this.ball, this.bricks, this.hitBrick, null, this); Is there any way I can achieve that? Many thanks Link to comment Share on other sites More sharing options...
warpig Posted March 25, 2018 Author Share Posted March 25, 2018 I've found the answer. Changing the collider in update() resolves the problem: update() { if(this.test === true) { this.physics.world.overlap(this.ball, this.bricks, this.hitBrick, null, this); } else { this.physics.world.collide(this.ball, this.bricks, this.hitBrick, null, this); } } Link to comment Share on other sites More sharing options...
Recommended Posts