Todi Posted July 26, 2016 Share Posted July 26, 2016 Hi guys, So, I want that my sprite just collide with left and right sides of the world bounds, and the top and bottom doesn't collide. What I did: // setup ball this._ball.anchor.set(0.5); this._ball.body.bounce.set(1); this._ball.body.collideWorldBounds = true; this._ball.body.checkCollision.up = false; this._ball.body.checkCollision.down = false; But, even I disabling the up and down collision, it still colliding with up and down world bounds. What I have to do? Thanks! Link to comment Share on other sites More sharing options...
TickleMeElmo Posted July 27, 2016 Share Posted July 27, 2016 I think there isn't really built in method like that, the checkCollision.up and down doesn't consider world bounds. one way is to just detect the collision yourself in the update func. For that method you could use Arcade checkWorldBounds and onWall Todi 1 Link to comment Share on other sites More sharing options...
Todi Posted July 27, 2016 Author Share Posted July 27, 2016 4 hours ago, TickleMeElmo said: I think there isn't really built in method like that, the checkCollision.up and down doesn't consider world bounds. one way is to just detect the collision yourself in the update func. For that method you could use Arcade checkWorldBounds and onWall Good tip! Thanks! Link to comment Share on other sites More sharing options...
symof Posted July 27, 2016 Share Posted July 27, 2016 15 hours ago, Todi said: Hi guys, So, I want that my sprite just collide with left and right sides of the world bounds, and the top and bottom doesn't collide. What I did: // setup ball this._ball.anchor.set(0.5); this._ball.body.bounce.set(1); this._ball.body.collideWorldBounds = true; this._ball.body.checkCollision.up = false; this._ball.body.checkCollision.down = false; But, even I disabling the up and down collision, it still colliding with up and down world bounds. What I have to do? Thanks! An easier solution is to create custom bounds. This is an example http://phaser.io/examples/v2/p2-physics/collide-custom-bounds Link to comment Share on other sites More sharing options...
drhayes Posted July 27, 2016 Share Posted July 27, 2016 You could also make two big sprites off the edges of your world bounds and collide against those. Todi and Tilde 2 Link to comment Share on other sites More sharing options...
Todi Posted July 27, 2016 Author Share Posted July 27, 2016 Just now, drhayes said: You could also make two big sprites off the edges of your world bounds and collide against those. It would be more simple! Good tip too! Link to comment Share on other sites More sharing options...
samme Posted July 28, 2016 Share Posted July 28, 2016 I believe there's game.physics.arcade.checkCollision.bottom = false; game.physics.arcade.checkCollision.top = false; Todi and jjwallace 2 Link to comment Share on other sites More sharing options...
oliversb Posted August 7, 2017 Share Posted August 7, 2017 On 27/07/2016 at 3:23 PM, symof said: An easier solution is to create custom bounds. This is an example http://phaser.io/examples/v2/p2-physics/collide-custom-bounds Can I use this kind of thing for arcade physics? Thanks Link to comment Share on other sites More sharing options...
Recommended Posts