olorin Posted October 12, 2014 Share Posted October 12, 2014 Hi, 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.http://examples.phaser.io/_site/view_full.html?d=p2%20physics&f=world+move.js&t=world%20move 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 90The ball bounces many times, and the speed gradually slowsPhaser 2.0.6: http://jsbin.com/moxijibebuta/1/edit?html,js,output The ball bounces one time and nothing…Phaser 2.1.2: http://jsbin.com/kipayexoqadu/8/edit?html,js,output Test 2: moveforward 1000 + angle 60The ball bounce many times, and the direction is fine for each bounce.Phaser 2.0.6: http://jsbin.com/wiloyizanucu/1/edit?html,js,output Indescribable…Phaser 2.1.2: http://jsbin.com/rejidageguhu/1/edit?html,js,output 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 More sharing options...
george Posted October 16, 2014 Share Posted October 16, 2014 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.5See: 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 examplehttp://examples.phaser.io/_site/view_full.html?d=p2%20physics&f=contact+material.js&t=contact%20material Regards George Link to comment Share on other sites More sharing options...
olorin Posted November 1, 2014 Author Share Posted November 1, 2014 Thank you very much George. I have tested to use contact material, and only "restitution" property seems to change the move. Change other properties do nothing. I hope that the old behavior will come back with the future releases… Link to comment Share on other sites More sharing options...
Recommended Posts