instantia

Water. Slowdown in P2 physic

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 :(

Share this post


Link to post
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 )

Share this post


Link to post
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)

Share this post


Link to post
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... 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.