Jump to content

Does physics scale work in phaser 2.0?


Nokdu
 Share

Recommended Posts

i've been looking through the examples.. and tried some coding for phaser 2.0.

 

i came across this 

http://examples.phaser.io/_site/view_lite.html?d=arcade%20physics&f=body+scale.js&t=body%20scale

 

but i was wondering if it was working as intended?

 

what i thought was that the sprite body would scale automatically when  i scale the sprite.. but to me in that demo that doesn't seem to work..

Link to comment
Share on other sites

in this example it is about sprite scale.. not gravityscale..     gravity scale works but you have to use it that way 

 

mind the "data"

player.body.data.gravityScale=0.5;

sprite scaling after enabling the physics body does NOT reconfigure the physics body..  this body is created with sprite bounds and stays this way until you configure it to change with sprite.body.setCircle() for example..   but it would be great if the physics body gets rescaled when the sprite scales..  i would totally agree with that!  

Link to comment
Share on other sites

I did talk to Stefan (the author of P2) about supporting body scaling, but the basic response was "no, it leads to physically impossible situations". So yeah, scale first, then create your body. Or if you don't want to scale in real time you could update the body size after the scale is completed.

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...