Jump to content

bug? restart the same state exactliy 5 times and p2 collisions are gone


valueerror
 Share

Recommended Posts

I'd put good money on p2 having run out of bitmasks, so it can't create any more collision groups. To check if this is the case or not, could you try this please:

 

When your state shuts down (so create a state shutdown function if you don't have one already) put this code in:

game.physics.p2.world.off("beginContact", game.physics.p2.beginContactHandler, game.physics.p2);game.physics.p2.world.off("endContact", game.physics.p2.endContactHandler, game.physics.p2);game.physics.p2.collisionGroups = [];game.physics.p2._toRemove = [];game.physics.p2.boundsCollidesWith = [];game.physics.p2._collisionGroupID = 2;game.physics.p2.postBroadphaseCallback = null;game.physics.p2.callbackContext = null;game.physics.p2.impactCallback = null;
Link to comment
Share on other sites

thx rich... 

 

i don't know if i'm doing it right with the shutdown function..  

 

http://test.xapient.net/phaser/swapstateanddie.html    here is the smallest example i could think of :)   just run to the right to x>500 to die..  

 

in this example it will happen after the very first state "reload"  

Link to comment
Share on other sites

Hah bloody hell, of course. What does P2.clear down? Clears all bodies from the world. What are the world bounds? A body :) And because p2 already exists, when the state starts again it never gets re-created. If you create your own 'floor' body you'll see it works fine, over and over I think. I'll carry on working through this here.

Link to comment
Share on other sites

like this .. .that works...  

http://test.xapient.net/phaser/swapstateanddiefloor.html

 

BUT  i think you need to know that in my initial example here  http://test.xapient.net/phaser/ALL/

 

i AM creating my floor body... and after 5!! (why the hell) resets collision is gone.. and it is a tilemap layer !?!

Link to comment
Share on other sites

thx for the build file..  didn't find the time (yet) to learn how to work with grunt..  

 

 

i'd say.. Problem solved in dev branch !!

 

 

(i've got a few other interesting things for you ^^)

 

did you stumble over this one? 

http://www.html5gamedevs.com/topic/4406-2-possibe-bugs-with-phaserbutton/#entry27288

 

 

thx again for all the work!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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