instantia Posted June 5, 2014 Share Posted June 5, 2014 How do I desired deceleration of the object in motion? Suppose when the object is in the water acts on it slowing. I tried to do velocity * 0.99. Slowing down there, but got out a lot of bugs. Now do so:this.obj.rotation = game.physics.arcade.moveToXY(this.obj, this.pointer.x, this.pointer.y, this.speed, 200);How do I make braking object?I've already rummaged Link to comment Share on other sites More sharing options...
marvster Posted June 5, 2014 Share Posted June 5, 2014 I would simply try to apply a different gravity to water, to simulate friction.For a more complex approach check this out: http://www.newton.dep.anl.gov/askasci/phy99/phy99x88.htm Link to comment Share on other sites More sharing options...
jpdev Posted June 5, 2014 Share Posted June 5, 2014 I think you are looking for "Damping"/*** Damping is specified as a value between 0 and 1, which is the proportion of velocity lost per second.* @name Phaser.Physics.P2.Body#damping* @property {number} damping - The linear damping acting on the body in the velocity direction.*/Object.defineProperty(Phaser.Physics.P2.Body.prototype, "damping",( http://docs.phaser.io/Body.js__.html#sunlight-1-line-1510 ) Link to comment Share on other sites More sharing options...
instantia Posted June 5, 2014 Author Share Posted June 5, 2014 I think you are looking for "Damping"/*** Damping is specified as a value between 0 and 1, which is the proportion of velocity lost per second.* @name Phaser.Physics.P2.Body#damping* @property {number} damping - The linear damping acting on the body in the velocity direction.*/Object.defineProperty(Phaser.Physics.P2.Body.prototype, "damping",( http://docs.phaser.io/Body.js__.html#sunlight-1-line-1510 ) thanks! I did damping. not correctly assigns the value) Link to comment Share on other sites More sharing options...
valueerror Posted June 5, 2014 Share Posted June 5, 2014 oh.. that's what damping is for.. i applied a force in the opposite direction of the player to slow him down.. but damping seems to be the correct way to do it.. thx edit: tried it.. somehow applying a force in the opposite direction of the playermovement seems to be working better for me... Link to comment Share on other sites More sharing options...
Recommended Posts