Hi!
I am making a player controller and I am using the Character Controller and the code that can be found in the Unity Scripting API. I am still learning how to use this and I need some help. Whenever my player hits the ceiling you can kinda float around there for a little while until you fall down again. How do I make so the player will fall when they hit the ceiling and not just float for a bit before falling?
Here is my code:
moveDirection.y -= playerStats.gravity * Time.deltaTime;
cc.Move(moveDirection * Time.deltaTime);
if(cc.isGrounded){
moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= playerStats.speed;
if(Input.GetButtonDown ("Jump")){
moveDirection.y = playerStats.jumpHeight;
}
}
Thanks in advance