Jump to content

P2 collideWorldBounds doesn't work after orientation has changed.


bubu
 Share

Recommended Posts

// boot.js 
this.game.scale.scaleMode = Phaser.ScaleManager.RESIZE;

// game.js

game.physics.startSystem(Phaser.Physics.P2JS);  //activate physics
//  Turn on impact events for the world, without this we get no collision callbacks
game.physics.p2.setImpactEvents(true);


var mySprite = game.add.sprite(100, 100, "ball.png");
game.physics.p2.enable(mySprite);

mySprite.body.collideWorldBounds = true;


I have a problem with a world bounds collision. I turned on P2 physics, created a sprite, set collideWorldBounds = true and it worked good. But after I changed orientation to album and brought it back to portrait my sprite stopped to collide with world bounds and flew out of the window.

I checked the size of game and world bounds. It didn't change, but collision didn't work anymore. Highly appreciate any help to solve this problem.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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