Search Unity

Question Need Help with Character Animation and Mobile Joystick Input

Discussion in 'Input System' started by pr_4nv, Dec 7, 2023.

  1. pr_4nv

    pr_4nv

    Joined:
    Dec 12, 2022
    Posts:
    2
    I'm working on a mobile game and facing issues with character animations tied to mobile joystick input. I have walking and idle animations set up for a character controlled by a CharacterController and a mobile joystick (FixedJoystick).

    Here's a snippet of my code:
    Code (CSharp):
    1. public class PlayerMove : MonoBehaviour
    2. {
    3.     public FixedJoystick joystick;
    4.     public float SpeedMove = 5f;
    5.     private CharacterController controller;
    6.  
    7.  
    8.     void Update()
    9.     {
    10.         Vector3 move = transform.right * joystick.Horizontal + transform.forward * joystick.Vertical;
    11.         controller.Move(move * SpeedMove * Time.deltaTime);
    12. }

    Despite my efforts, the animations aren't responding as expected to mobile joystick inputs. The 'IsWalking' and 'IsIdle' parameters are set correctly, but the animations seem off.

    I'd appreciate any help or suggestions on properly integrating mobile joystick input with character animations. If anyone has encountered similar challenges or has insights into the code, please share your thoughts!