Legomite Posted March 5, 2017 Report Share Posted March 5, 2017 How do you make friction in Arcade Physics? I tried using: sprite.body.friction = new Phaser.Point(100, 100); and also tried doing: sprite.body.friction.y = 10000000; sprite.body.friction.x = 10000000; but nothing seems to work... I applied this to the platform the player is standing on. The player moves by setting the velocity to 300. Once I stop the controls, it seems to slide forever until it eventually falls out of the world.... Quote Link to comment Share on other sites More sharing options...
Rydez Posted March 5, 2017 Report Share Posted March 5, 2017 You're heading in the right direction. But, it seems like friction is only in the box2d plugin. You have several options. - You could set the velocity to zero when the controls aren't activated. - You could decelerate the player when the controls aren't active. - You could roll your own friction code. This would require some understanding of physics. - You could purchase the box2d plugin. Personally, I'd go with the second option of decelerating the player. It's simple and effective for simulating the presence of friction. You could determine the player's direction and set the acceleration in the opposite direction. Quote Link to comment Share on other sites More sharing options...
samme Posted March 5, 2017 Report Share Posted March 5, 2017 In Arcade Physics friction is how much (in range [0, 0] to [1, 1]) of a platform's velocity is transferred to an object riding it. You can use drag on the player to slow it down. Bonsaiheldin, drhayes and Rydez 3 Quote Link to comment Share on other sites More sharing options...
Rydez Posted March 5, 2017 Report Share Posted March 5, 2017 3 hours ago, samme said: In Arcade Physics friction is how much (in range [0, 0] to [1, 1]) of a platform's velocity is transferred to an object riding it. You can use drag on the player to slow it down. Oh, cool! I didn't know that. Might refactor some code to use drag rather than manually setting the acceleration. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.