- Home /
Unwanted Character Controller Floating
As soon as I press play, my "CC" rises a few cm above the ground and just stays there. Here is what I did:
Start a new project
Create the ground (Cube)
Create the Player(Cube) + add Character Controller to the Player
Add this script to the Player
public class PlayerMovement : MonoBehaviour {
public float playerSpeed = 5.0f; CharacterController cc; // Use this for initialization void Start () { cc = gameObject.GetComponent<CharacterController> (); } // Update is called once per frame void Update () { Vector2 usrInput = new Vector2 (Input.GetAxis("Horizontal"), Input.GetAxis("Vertical")); Vector3 moveDir = new Vector3 (usrInput.x, 0, usrInput.y); cc.Move (moveDir * Time.deltaTime * playerSpeed); } }
And I am having the floating issue already.
I did the same thing a few days earlier and it worked without any issues.
It seems that the same issue has appeared in all of my projects.
UPDATE: If I raise the cube off the ground, attach a rigidbody and a script with $$anonymous$$ove (Ins$$anonymous$$d of simple move), the cube doesn't fall, it rotates on spot changing directions every few milliseconds.
$$anonymous$$ove doesn't apply gravity, Simple$$anonymous$$ove does
Thanks for replying, that's why I "attach a rigid body" and set the gravity on when I am using $$anonymous$$ove, but it doesn't behave as expected.
Your answer
Follow this Question
Related Questions
Character Controller Jumping Higher against Box Collider 0 Answers
Disable Character Controller Gravity 1 Answer
CubeWorld's controller 0 Answers
player isn't rotating along y-axis 0 Answers
Character Controller Not Moving Locally 2 Answers