- Home /
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.
Answer by Piflik · Aug 29, 2012 at 10:48 PM
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.
Answer by kag359six · Aug 29, 2012 at 10:58 PM
Why not fake it and decrease the gravity variable to slow down the falling making it look like you are sinking.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
player collite with object and start moonwalking 1 Answer
Collision Issue - Walk Through Object 0 Answers
Movement with collision detection but without a CharacterController 1 Answer
how to stop colliders in a collision while using kinematic ways instead of physical ways? 2 Answers