Jump to content

p2 loses bounds exiting from fullscreen


jmp909
 Share

Recommended Posts

when I exit from full screen my player (with its own collision group) stops rebounding against the world edges

 

i've tried various combinations of these with no luck

this.game.scale.stopFullScreen();this.game.world.setBounds(0,0,480,32*11*10) // or ...// this.layer1.resizeWorld()this.game.physics.p2.updateBoundsCollisionGroup();this.game.physics.p2.setBoundsToWorld(true, true, true, true,true)

thanks for any advice

 

was also mentioned here by somebody else http://www.html5gamedevs.com/topic/15385-issue-with-p2-stopfullscreen-collisionmask-world-bounds/

Link to comment
Share on other sites

I can't create a full screen jsfiddle or sandbox as they are not https

 

however also note this is enough to break p2 bounds (ignoring full screen for now)

 

this.game.world.resize(480,320) // breaks p2 bounds..  does not collide player with world bounds anymore
this.game.physics.p2.setBoundsToWorld(true, true, true, true, false) // does not fix it

 

 

try this please

http://phaser.io/sandbox/bSHTBFtx/play

 

hit the 'R' key to resize the world.. i resize it to 800,600 for now which is the same size but the effect is the same. the hamster ship no longer collides with the world bounds

Link to comment
Share on other sites

  • 2 months later...

it appears all collision groups need to be recreated after resizing game world.. you can see here (instructions in code)

http://phaser.io/sandbox/SXKpakhM/play

 

That didn't work as simple for me with the fullscreen in chrome (didn't tested with others navigators)

 

 

I solved it by adding a listener on webkitfullscreenchange and then reset collisions in it.

It was kinda strange because resizing the game world and then reset collisions worked perfectly for me.

 

By the way, thank you for this link, you saved my day !

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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