Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
Dismiss Notice
Join us now in the Performance Profiling Dev Blitz Day 2023 - Q&A forum where you can connect with our teams behind the Memory and CPU Profilers and the Frame Debugger.

[solved] Character Controller broken?

Discussion in 'Unity 5 Pre-order Beta' started by Aceria_, Oct 29, 2014.

  1. Aceria_

    Aceria_

    Joined:
    Oct 20, 2014
    Posts:
    78
    EDIT: Rubber Ducked it I guess, apparently it had to do with a rigidbody being on the player for some reason, removing that fixed it.

    I just upgraded my project to Unity 5, and the only thing that doesn't work so far is the character controller, here's the script I'm using:

    Code (csharp):
    1.  
    2. if(charactercontroller.isGrounded){
    3.                 moveDirection = new Vector3(InputManagerNew.instance.L_X(), 0, InputManagerNew.instance.L_Y());
    4.                moveDirection = transform.TransformDirection(moveDirection);
    5.                moveDirection *= speed;
    6.            }
    7.        
    8.            moveDirection.y -= gravity * Time.deltaTime;
    9.  
    10.            charactercontroller.Move(moveDirection * Time.deltaTime);
    11. }
    12.  
    When I run the game the character will jump into the air and simply start floating upwards rapidly.
    Commenting out line 10 will keep the player in position (but obviously then you can't move anymore). Has anyone found a workaround for this?
     
    Last edited: Oct 29, 2014