While my code for this lecture is working properly, I’m a little confused as to why mover.Stop() isn’t constantly being called and stopping my character’s movement mid-stride when I don’t have a target. Am I misunderstanding this function?
Thanks!
private void Update()
{
bool isInRange = Vector3.Distance(transform.position, target.position) <= weaponRange;
if (target != null && !isInRange)
{
mover.MoveTo(target.position);
}
else
{
mover.Stop();
}
}