Rotating platform

Hello everyone.

I’m creating a platform game, and in a certain point of the level I want the character to be able to run over a rotating plataform (Like the ones in super mario sunshine, for example). I’ve created a cube with the unity editor, attached a rigidbody to it (the box collider is also attached) and made it rotate with this script:

function FixedUpdate () {
var deltaRotation : Quaternion = Quaternion.Euler(Vector3(0,0,5) * Time.deltaTime);
rigidbody.MoveRotation(rigidbody.rotation * deltaRotation);

My main character has a characterController component attached and moves using the characterController.Move function like in many examples on the net.

The problem is that when the platform is rotating, if you’re standing still, when a certain point in the rotation is achieved (a little after it has completed a whole rotation, and the platform is horizontally placed) the character Controller collider simply trespasses the box collider and my character fells, trespassing the whole platform.

Does anyone know why this is happening? Should I use another code to rotate the platform? I think this has something to do with the physics engine and collision detection.

Any help would be appreciated.

It sounds like parenting the player with the moving platform could be an idea.

This guy teaches how to parent. (I learned from him)

Transform.parent docs

Quite simple solution, but it should work really great.