This question was
closed Jul 02, 2020 at 09:41 PM by
kadamdhruv98 for the following reason:
Dont use a rigidbody on an enemy
Question by
kadamdhruv98 · Jul 02, 2020 at 09:26 PM ·
navmeshnavmeshagentfollowenemy aifollow player
Navmesh agent enemy moving to players last seen position
Dear coders, For some reason, for some reason , using the navmesh agent with the script below, my Agent keeps moving to the last seen position for the player, and not its current position. Im using 2019.4.01f. Any help would be much appreciated
public class Follow : MonoBehaviour { public Transform player; NavMeshAgent nav; // Start is called before the first frame update void Start() { nav = GetComponent(); }
// Update is called once per frame
void Update()
{
nav.SetDestination(player.position);
}
}
Comment