Jump to content

Friction when using Arcade physics


Recommended Posts

I am new to Phaser, so definitely a ton I do not know. I was experimenting with it by working on a little game where a player jumps from one platform to another, based on where the user clicks. I did this by setting the velocity of the player's body. However, once it lands on the other platform it just keeps sliding. I looked into the documentation and found a Friction property in Arcade.Body but I am not sure how to use it. I looks like it should be applied to the platform the player lands on, but it seems to require a point, and I have not been able to find an example using it.


I did implement a custom friction method using the collisionCallback used by the collide method, that reduces the x velocity incrementally to 0 and results in this behaviour:




Which seems to work fine, but if there is a built in way to set it, I would prefer to use that.

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

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.


  • Recently Browsing   0 members

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