Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Moving an old CharacterController Move system that uses the old input manager

Discussion in 'Input System' started by KrisTheCoolGuy, Jan 29, 2022.

  1. KrisTheCoolGuy

    KrisTheCoolGuy

    Joined:
    Feb 16, 2020
    Posts:
    10
    Recently i started to slowly porting my PlayerController.cs script to the new input manager, i got my actions map setup but currently i'm stuck into moving this part:

    PlayerController.cs Line 270
    Code (CSharp):
    1.     private void HandleMovementInput()
    2.     {
    3.         /* Check if we are sprinting or not and assign it to a variable */
    4.         float movementState = ( IsInternalCrouching ? crouchSpeed : IsSprinting ? sprintSpeed : walkSpeed );
    5.  
    6.         /*  Set our currentInput for Vertical/Horizontal */
    7.         currentInput = new Vector2( movementState * Input.GetAxis( "Vertical" ), movementState * Input.GetAxis( "Horizontal" ) );
    8.  
    9.         float moveDirectionY = moveDirection.y;
    10.         moveDirection = ( transform.TransformDirection( Vector3.forward ) * currentInput.x ) + ( transform.TransformDirection( Vector3.right ) * currentInput.y );
    11.         moveDirection.y = moveDirectionY;
    12.  
    13.         /* Do our player animations */
    14.         DoPlayerAnimations();
    15.     }
    and here's how my Action Map looks like: