Jump to content

Unset static property in P2 physics


Vaclav
 Share

Recommended Posts

Hello,

 

I experience that once a body in p2 physics has been set to static, then static = false has no effect.

The documentation says it should return to dynamic behaviour when static is set to false.

 

What I did:

take this example:

http://examples.phaser.io/_site/view_full.html?d=p2%20physics&f=static+body.js&t=static%20body

 

After:

//  Make staticstatic1.body.static = true;static2.body.static = true;
Add:
static1.body.static = false;static2.body.static = false;
Still the bodies remains static. I'm using Phaser 2.0.5.
 
What am I doing wrong?

 

Link to comment
Share on other sites

It doesn't help.

I've tried with Phaser 2.0.7 as well.

 

If I set to static with motionState = STATIC and then I set it to DINAMYC it works, however, the static object's collision is not correct (the dynamic object penetrates the static object, then a force is applied to the dynamic body which tosses it away.

Link to comment
Share on other sites

I've found the solution: one has to restore the body's mass when setting static property to false, because the static body's mass is set to 0.

Should I create an issue, or am I expected to set the mass manually?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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