In our 2.5D platformer, we have a large number of rigidbody physics objects, and use rigidbodies for characters, including players.
So, in the spirit of good platform-style games, we added moving "elevator" platforms. How hard can this be, right?
Well, tricky enough. Vertical elevators worked - sort of. The rigidbodies vibrated on them. But horizontal elevators were a fail. Some rigidbodies would stick and ride, others, well, not so much. Players and enemies sliding off.
Adding a rigidbody to the elevator made things more odd. Objects falling through, sinking into the platforms, not the behaviors we were looking for.
So off to Unity answers! The most recommended solution was to make the rigidbody become a child transform upon collision in script. This is a real pain, as we have many different objects that would need this script. And some character objects ride in other objects, which get tedious. And we have to tag all the platforms, which makes adds complexity to making cool dynamic elevators in-game.
Then I noticed the solution recommend by HNX at the bottom of the thread below. PERFECT! Works great. Just be sure to make your elevator kinematic and move it in FixedUpdate!
Moving using only Rigidbody.MovePosition and Rigidbody.MoveRotation in FixedUpdate fixes the slipping and gives a very smooth and accurate simulation.
For kinematic rigidbodies it applies friction based on the motion of the rigidbody. This lets you simulate moving platforms with rigidbodies sitting on top of the elevator. If you want other rigidbodies to interact with the kinematic rigidbody you need to move it in the FixedUpdate function.