Player sliding away

Hello guys i have a problem. When my player is standing on a platform you should be sticked on it, but instead you are slightly sliding away from it
I need him to stay on the platform

set rigidbody to kinematic for platform?

It already is

One option would be to increase the friction of the platform to 1 and the player’s one to high enough value. To eliminate the slide completely, you need them both to have friction at max 1. But then your player will not be able to move. After all, its a simple capsule that just slides on the ground surface. If both the ground and the capsule will have max friction - no sliding will take place.

So, you want the player to not have a maximum friction and allow it slide. But then that means it will slide on moving platforms. What can help is you can reduce the speed of the platform, so that it would not be enough to slide the player, but would still move. Another option, is to not allow a player to move while on platform - this can work only in some gameplay scenarios, while not suitable in others.

The best solution would be to build a local physics grid around the moving platform, and simulate the player in the local grid. The player would then not slide, since it would consider the world is stationary. This might be hard to implement, though, as you’d need to manage moving the player from world to local grid and back.

1 Like

I’ve been meaning to try this idea ever since I saw it https://twitter.com/AlexRoseGames/status/1274551105461067776

1 Like

Could be interesting to explore. Since the platform is a kinematic body, then Ammo will not calculate its velocity. One would then need to calculate it manually. I think comparing a travelled delta between two frames can give a good enough result? Hmm, let me try that.

Edit:
Here is an attempt:
https://playcanvas.com/project/734410/overview/moving-on-a-moving-platform

1 Like