Hey I’m new to this and I’ve been having some troubles with my very small game project I just have to make my character move through pathfinding but what’s giving me trouble is the animation. The cahacter has an idle animation until she starts walking, but after maybe one or two cycles she just freezes and floats around the room. She also doesn’t go back to the idle animation and I don’t know what to do.
Here’s my code in case that’s needed:
using UnityEngine;
using UnityEngine.AI;
public class PlayerController : MonoBehaviour
{
public Camera Kamera;
public NavMeshAgent Agent;
public Animator Anim;
void Start ()
{
Anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
{
Ray Strahl = Kamera.ScreenPointToRay(Input.mousePosition);
RaycastHit trifft;
if (Physics.Raycast(Strahl, out trifft))
{
Agent.SetDestination(trifft.point);
Anim.SetBool("geht", true);
} else {
Anim.SetBool("geht", false);
}
}
}}