Hi. I am using the following free asset: https://assetstore.unity.com/packages/tools/input-management/joystick-pack-107631
And I am trying to trigger some animation based on the distance from the center of the joystick that the user is touching indication the speed. I read the manual and could not find any information that could help me to create a condition. This is what I have now:
using UnityEngine;
public class Player3DExample : MonoBehaviour {
public float moveSpeed = 8f;
public Joystick joystick;
void Update ()
{
Vector3 moveVector = (Vector3.right * joystick.Horizontal + Vector3.forward * joystick.Vertical);
if (moveVector != Vector3.zero)
{
transform.rotation = Quaternion.LookRotation(moveVector);
transform.Translate(moveVector * moveSpeed * Time.deltaTime, Space.World);
if ( CONDITION HERE )
{
FindObjectOfType<AnimationControl>().SetAnimation("isWalking");
}
else
{
FindObjectOfType<AnimationControl>().SetAnimation("isRunning");
}
}
}
}
Can someone help me on this? Thanks