Hi, I’m trying to add animations to the units, it works for moving and when attacking. Only thing is that the animation works for the host, not the joined player. Even when the joined player unit comes into view on the host screen the unit animation works for the host.
Guess what I’m saying is that both players units animats for the Host, not the joined player.
[ServerCallback]
private void Update()
{
Targetable target = targeter.GetTarget();
UpdateAnimation();
if(target != null)
{
if((target.transform.position - transform.position).sqrMagnitude > chaseRange * chaseRange)
{
agent.SetDestination(target.transform.position);
}
else if(agent.hasPath)
{
agent.ResetPath();
}
return;
}
if (!agent.hasPath) {return;}
if (agent.remainingDistance > agent.stoppingDistance) {return;}
agent.ResetPath();
}
private void UpdateAnimation()
{
Vector3 velocity = agent.velocity;
Vector3 localVelocity = transform.InverseTransformDirection(velocity);
forwardAmount = localVelocity.z;
turnAmount = Mathf.Atan2(localVelocity.x, localVelocity.z);
animator.SetFloat("Move", forwardAmount);
animator.SetFloat("Turn", turnAmount);
}