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

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.

Guest
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.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.