- Home /
Other
NavMeshAgent CalculatePath to SetPath ( Agent new Path, SetPath, initiatePath?)???
So, I had an idea. Woo. The idea runs on compiling NavMeshAgent to frequently update a set path to a moving target, without running said path until LOS/FOV/Range is near.
void Update()
{
//agent.SetDestination(Target.transform.position); /* The goal */
agent.CalculatePath(Target.transform.position, new NavMeshPath(new));
if (agent.hasPath == true)
{ agent.SetPath(new NavMeshPath(new)); }
if (agent.hasPath == false)
{ agent.hasPath(new NavMeshPath(new)); }
}
The idea, been researching for a solution dealing with optimizing AI Follow/Chase player function. Noticed through 10 various methods that they all have no idea of where player is until said player is in range, and then it does all of the calculations and drops frames down to 10 on a spike, (Even when it had the variables stored). So, if the paths where pre-calculated while running say "patrol", then once in Range sets path from pre-calculated ones. This would stop the drop spike from reoccurring.
I'm a noob, tackling a bullhorn of a monsoon. For a college project, due on Wednesday. Anything from references to blogs about how these are implemented or even a keen help of hand. Your reward will be 2 tech demo games. And a smile. Thanks in advance.