Jump to content

[P2, move] Differences between versions


Recommended Posts



I develop a game which uses P2 and collisions. But in the latest versions, the behavior of move, speed and collision are very different.


My reference example is “World move” between Phaser 2.0.6 and the lastest version.


I think the move behavior is more realistic in Phaser 2.0.6. So, how to keep these behaviors with the last version?

I have made live examples with jsbin, to see the differences :


Test 1: moveforward 3000 + angle 90

The ball bounces many times, and the speed gradually slows


The ball bounces one time and nothing…


Test 2: moveforward 1000 + angle 60

The ball bounce many times, and the direction is fine for each bounce.




What do you think about that? Can we have the movement from 2.0.6 with the latest version?

Link to comment
Share on other sites

Hi, this occurs first in Phaser 2.1.0, which introduced P2 0.6.0. But I can't see anything that would cause this.

It looks like something changed the restitution (bounce factor) handling. You can get the old behaviour by setting the restitution to a value higher than 0 in the default material:

//to this once in your code. Be careful! This will change the restitution for all bodies without their own material. this.physics.p2.world.defaultContactMaterial.restitution = 0.5

See: http://jsbin.com/rejidageguhu/3/edit (2.1.2 and bounce)

If you want to change the restitution you could create your own contact material instead. Have a look at the phaser example
Regards George
Link to comment
Share on other sites

  • 3 weeks later...

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.

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.


  • Recently Browsing   0 members

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