Character with controller flies off map.

I have just added a character controller and now every time I hit play the character starts flying off the map instantly. Anyone know how to fix that?

I would take off the rigid body, as a character controller has its own… behind the scenes.

So, you are adding jumpForce to your moveDirection.y every frame… thats the issue. Should it be inside the if statement for jumping?

move this out of the if statement: moveDirection = new Vector3(Input.GetAxis(“Horizontal”), 0, Input.GetAxis(“Vertical”)); and put it above the if check for jumping - so you can move.

You’ve set moveDirection.y to the jumpForce value, thus a constant movement upwards. moveDirection.y needs to come back down to allow the character to fall. You need something like this.

if(Input.GetButtonDown("Jump") && controller.isGrounded){
    moveDirection.y = jumpForce;
else if(!controller.isGrounded){
    moveDirection.y -= yourGravityAmount;
    moveDirection.y = 0;