How do I make my platform not be jerky?

I have a platform that only moves down when the player is standing on it, otherwise it moves back up again.

To do this, I’m using onTriggerEnter to determine when the player is touching a box collider on the surface of the platform. However, when the platform moves down, the motion is jerky. I assume the player is slightly moving off the box collider every frame or so. How can I fix this?

This isn’t a problem with OnTriggerEnter, so much as it is a problem with your platform script! If you set it up so that the platform always moves before your player does in script execution, you might get a better result. I don’t think you should be using OnTriggerEnter for this, by the way- maybe put a box trigger on top of the platform, and use OnTriggerStay backed up by raycasting from you character’s feet.

Basically, it’s a script execution order problem. But that’s easy to fix, as of Unity 3.4!

If the player is a CharacterController, a possible cause is the player movement script: FPSWalker.js and the CharacterController.Move example (both are almost the same) zero the vertical speed (y component of MoveDirection) when the character is grounded. If the platform moves down, the gravity must accelerate the character during a couple of frames until it touches the platform - which will ground the character, zeroing its vertical velocity again, etc. This is specially true when the character moves in Update, because the platform collider will be moved in the physics cycle: the different rates create a jerky movement.

A possible solution is to place the movement code in FixedUpdate (you can try to just rename Update to FixedUpdate); if you are using the standard First Person Controller, just set the option Use Fixed Update in the Character Motor component, in the Inspector.

If this doesn’t solve the problem, edit your question to include the player movement script (not necessary if it’s CharacterMotor.js).