Move Character on Moving Platform

Hello everyone.
I’m implementing moving platforms in my game, and I have them working fine if you don’t more around, but if you do everything falls apart.

I’m moving the player by modifying the rigidbody’s velocity directly, for this reason if I assign the player as a child of the platform it won’t move with the platform.
What I’m doing right now is, while the player is standing still, changing the rigidbody’s velocity of the player to the one of the moving platform. But of course this only works if the player stands still.

Is there a way to have the player being able to walk on the platform and not slide off?

I will post my code if that’s necessary.

As long as you don’t rotate the platforms, one easy thing you can do is just add the platform’s velocity to your calculations whenever it’s touching it. Rotation platforms however, would need a bit more math to do that.

1 Like

Oh my God I’m so dumb! That was the solution all along, I just needed to add the velocity of the platform directly to my rigidbody’s velocity!
Thank you very much!