So, I created this script where my pet follows me and I all animations are working(2) but the transition is really bad… From Idleing to walking its like really bad…cant describe it but I assume you can imagine it… How can I create transition between them? Parameters in animator controller seem not to work so this is my option…
using UnityEngine;
using System.Collections;
public class pet : MonoBehaviour
{
public float speed;
public float range;
public Transform player;
public CharacterController controller;
public Animation move;
public Animation Idle;
static Animator anim;
private object target;
private void Start()
{
anim = GetComponent<Animator>();
move = GetComponent<Animation>();
Idle = GetComponent<Animation>();
}
void Update()
{
if (!inRange())
{
chase();
}
else
{
transform.LookAt(player.transform);
Idle.Play("idleLookAround");
//anim.SetBool("isWalking", false);
//anim.SetBool("IsIdle", true);
}
}
bool inRange()
{
return Vector3.Distance(transform.position, player.position) < range;
}
void chase()
{
Idle.Stop("idleLookAround");
move.Play("walk");
//anim.SetBool("IsIdle", false);
//anim.SetBool("isWalking", true);
transform.LookAt(player.position);
controller.SimpleMove(transform.forward * speed);
}
}