Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

[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:
    81
    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