Delete waypoint and enemy should not be too close to the edge

Hey there!

Some newbie questions from me today.
This questions belongs to a 3d project (platformer game).
If the enemy is out of the trigger from the player, they should stop moving.
canSearch = false
I know i can stop them with canMove = false … but if they jump down of a platform and the player is too far away in that moment, then the enemy “fly” in the air, because he cant move and hold this place without falling down (that looks too bad).

To solve this problem i thought about to stop search… this works at the beginning of the game, but if the enemy have already a waypoint, it seems he follow it till the end.

1.) This lead to my first question: how can i delete the waypoint he want to move along, after i did “canSearch = false” ?
Second question is about the enemy, if he follow the player, he likes to go very close to the edge, it would look better if the enemy stay a bit more away from the edge.
2.) How can i let the enemy not go too close along the edge is there somewhere an option for it? (Using GridGraph actually).
3.) I also have a question about updating this Graph (without lag), because of changing environment? It seems it consume a lot of the computer power and gives always some lags. It would be good to update them each second without any lag.
The environment can change very fast and the enemy should somehow “know” where is a hole in the ground which he cant pass.
Actually it happens easy to let them fall into it.

Other ideas for these problems are also welcome.
Thank you.

Edit: I forgot i have a 4. question.
4.) I would like if the enemies are not in range of the player (i do it with a trigger to let them know about it), that the enemies just walk randomly somewhere while they are “idle” and have no search goal). Is there a way to do that?

Edit again:
I believe i have the solution for the 1.) question. If they come in the trigger, they get a speed value. If they exit the trigger, i set speed to 0. This seems to do it actually. I will try more about this, also other solutions are very welcome to learn more. :slight_smile:

Hi

You second edit seems like a good approach for now.
I am relatively soon going to release an update to the package which adds a whole bunch of nice properties to the movement scripts. Among them is a property called ‘isStopped’ which, if enabled, will cause the character to stop following its path and slow down as quickly as it can, but it will still be able to use local avoidance and gravity.

  1. Maybe you want to try the ‘erosion’ setting.
  2. Make sure you are profiling when ‘Show Graphs’ is disabled. Updating the graph gizmos is quite slow.