I am now currently using this code snippet to try and change my character back to the running animation state using the joystick on a ps4 controller. I am currently able to get the running animation working if I click in either the left or right joystick buttons while running but I am unable to get the animation working without clicking in the buttons on the joysticks.
if (Input.GetAxis("Horizontal") > 0.3f && skeletonAnimation.state.GetCurrent(0).ToString() != "Jog" && isGrounded) //>0 goes to the right
{
state.SetAnimation(0, jogAnimation, true);
transform.Translate(Vector3.right * playerSpeed * Time.deltaTime);
if (isFacingLeft)
{
FlipPlayer();
}
isFacingLeft = false;
yield return new WaitForEndOfFrame();
}
How am I supposed to get this code snippet to trigger my animation state?
Edit: I have also noticed that the player starts his run animation when pressing down the O, Triangle, and Square keys on my ps4 controller. They have to be held down while moving to have the run animation to display properly. In my if statement I never reference the usage of a key to trigger the run animation so I do not understand what is going on.
Tim
Ok so I have debugged this issue extensively now. The parameters are all being met by my if statement but the animation is staying on the idle animation unless if I click in the joystick buttons or the square triangle circle buttons on the controller. Not sure why the animation is being picky but I think it has something to do with the fact that getting an Input.GetAxis does not actually rerturn a button key or keycode while pressing a button down does.
Closed: Figured out the issue. It was in another method that was overwriting the animation state.
Tim