I have an elevator that moves up and down. When moving up and stopping immediately or changing directions, the character on top is thrown up by the force the elevator was applying. How can I reduce this force to zero? I’ve tried parenting the character, maxing out the mass of the character, raising the gravity scale (works, but then I can’t jump anymore or have floaty physics), giving them physics materials with 0 friction and 0 bounciness, setting the player’s velocity to 0 when the elevator stops, etc, and they don’t work. The character has a rigidbody2D. The platform has a kinematic rigidbody2D.
If the player doesn’t need the ability to pace back and forth while on the elevator, then perhaps the moment the elevator starts moving, you could establish a DistanceJoint between the player and the elevator. Then when the elevator reaches the top, you destroy the joint, and the player can then walk off the elevator.
Honestly, have you tried just not stopping or changing directions suddenly? Real elevators don’t do that, and if they did, the passengers would indeed bounce into the air. Why not smooth out the movement, so it glides to a halt, instead of stopping abruptly? That would look better in addition to solving your problem.
1.) Make the character a child of the platform when it enters, and set “rigidbody2D.isKinematic = true”. Once it reaches it’s destination, unparent and set isKinematic back to false.
or
2.) Drive your elevator with physics code instead of animation, and merely have the character set it’s velocity to that of the platform that is under it’s feet “if platform.tag = PhysicsPlatform” for example. You’d want this to happen before your movement code. No messy parenting or rigidbody setting changes. There’s some example code here for doing this: http://forum.unity3d.com/threads/229918-Moving-platforms-are-slippery?p=1533745&viewfull=1#post1533745