Hi all… im having trouble making from what i know is a super simple thing to do make an enemy that tracks to the player… or follows it… what is the easiest way to do this? I’ve created a tag to my player called: “Player” do i track it? how would i do that? and if you could code in C# that would be awesome
you can use Path finding .
void Chasing ()
{
// Create a vector from the enemy to the last sighting of the player.
Vector3 sightingDeltaPos = Player.tranform.position- transform.position;
// If the the last personal sighting of the player is not close...
if(sightingDeltaPos.sqrMagnitude > 4f)
// ... set the destination for the NavMeshAgent to the last personal sighting of the player.
nav.destination = enemySight.personalLastSighting;
// Set the appropriate speed for the NavMeshAgent.
nav.speed = chaseSpeed;
}