Sinking Sand

This is driving me crazy because while it seems like an easy problem to solve, I can’t seem to provide a solution to the issue. I’m trying to create a scenario where the player steps on an object’s collider–for a, say, plane, cube or terrain–and while the player is colliding with it, the player slowly sinks down the Y axis, while still being able to move along the X and Z axes.

Basically, the way I’ve set this up is that there is a First Person Controller that collides with an object, the object’s collider’s IsTrigger property being set to true. In the object’s “sink” script, there is an OnTriggerStay function that decreases the player’s Y position by a certain amount. However, no matter what I set for that amount (Which is a float), the CharacterController always falls straight through the object, not sinking as I intended.

Any suggestions/tips would be greatly appreciated.

The problem is, that the FPS controller is affected by gravity. If you have no collider below the player, you it will fall. You would have to disable gravity for the player at the same time.

Why not fake it and decrease the gravity variable to slow down the falling making it look like you are sinking.