- Home /
 
Character floating after walking up higher terrain/object
I want to fix this but I can't find any tutorials for this. The problem is, if I walk the character on the higher terrain or anything that can be walk. The character will float once I leave on the higher terrain. I want something that the character will stays on the ground. The components that I used are character controller and capsule collider. Thanks in advance guys.
PS: The curves that you see is an object. Its not a bumpy/raised or painted height terrain.
The game will start with this position. 
So... if I walk back, it will look like this: 
@ john_wujeck Hey man, I know it is an old question, but did you fix it? I got the same problem here and don't know what to do....
Are you using a rigidbody? if so then did you check the use gravity?
Answer by Magso · Jun 08, 2019 at 11:48 PM
Character controller doesn't have gravity, it is like a kinematic body with a few properties. You will have to code gravity using CharacterController isGrounded and velocity. Here's a simple example based off the Scripting API
 CharacterController controller;
 float gravity;
 float weight;
 
     void Start()
     {
         controller = GetComponent<CharacterController>();
     }
 
     void Update()
     {
         if (!controller.isGrounded)
         {
             controller.velocity.y -= gravity;
             gravity += weight;
         }
     }
 
              Your answer