How to make collision with moving CharacterController and moving Collider.


I'm trying to create a third-person action game and use a CharacterController for my player gameObject and there are a cube with a box collider which moves like piston.

The player can collide with not-moving face, top and 2 sides, of the cube, but the player can pass through the cube along the moving. For example, if the box moves along with X-axis, the player can move through it along the X-axis.

How can I make them along the collider-moving axis?

Have a look at the 2D Platformer tutorial. There you can see scripts for moving platforms, and how the collision events are implemented in order to push the CharacterController.