Update Current Path Fast Reaction

Hi. I have checked the documentation and forums and I have not seen anything related.

I tell my entity move to a destination. Then I set up a new path changing ai.destination and ai.SearchPath() to have a better reaction, but the ai is moving to the old destination.

How can it be changed to react faster to destination changes?

IMG Example:

Using:

  • Graph: GridGraph
  • AI: AIPath

Hi

Could you post the code you are using for this?

Just as I said:

ai.destination = RandomArea();
ai.SearchPath();

It is important how you call this code. Do you happen to do it every frame for example?
Does the log say anything interesting (enable A* Inspector -> Settings -> Path Logging)
Do you have an AIDestinationSetter component attach to the agent? If so, that will override whatever destination you set.

I have InvokeRepeatings, some scripts and a lot of Coroutines with diferent behaviours for the entities, so it is dificult to tell you what code I have.

Are you trying to say that with that code it should work like the “expected behaviour” image?

If the answer is YES is just my problem and not from the A*.

To be honest I don’t quite understand that image. Which symbols are units and which ones are destinations? It doesn’t make sense to me.

Setting the destination and calling SearchPath (actually even without calling SearchPath, as that will just give it a quicker reaction time) should be sufficient for making the agent move to whatever destination you want.

1 Like

Okey, so it is something related with my code.
Thank you Aron.

PD:
Brown is starting position.
Yellow is 1st destination from brown and lines are the “shadow” where ai moved.
Yellow speech bubble is where I am (supposedly) changing the destination to Blue point.
Blue lines are the shadow where AI moved when destination changed to Blue.

Surely that drawing only makes sense in my head :stuck_out_tongue: