Jump to content

Water. Slowdown in P2 physic


instantia
 Share

Recommended Posts

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

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

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

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

 Share

  • Recently Browsing   0 members

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