NPC stops movement (i use AiPath + RVOController/RVOSimulator)

  • A* version: [5.2.4]
  • Unity version: [Unity 6 - 6000.0.26f1]

I’m new to A* Pathfinding and would appreciate any help.
I’m creating the npc’s for a restaurant, the positions they move to are the area where they can order food, a waiting line, the chairs and return to the spawn point so can return to the objectPool.

In AstartPath I set the path with RecastGraph and added RVOSimulator so that the NPCs do not overlap.

For the movement of the NPCs I am using AIPath and RVOController so that it can work with RVOSimulator.

NPCs are the customers of the restaurant, and can order food, sit down to eat, and leave the restaurant (For testing I only set them to be able to sit in the first 4 chairs on the right).
The problem is that at some random moment it stops walking completely before reaching the assigned destination.

The points I want them to go to are drawn with gizmos.
I’m new and I don’t know if this is failing because of a bad configuration on my part or because I’m not using the right variables to interact with AiPath:

  1. To assign the destination point that NPC should reach use aiPath.destination = destinationPosition;
  2. To check if I have already reached the target position I use aiPath.reachedDestination == true
  3. When the NPC has reached the destination position I stop it with aiPath.canMove and also stop the rotation with aiPath.enableRotation, then I rotate the transform so that it faces a specified point on the destination and end the walking animation to activate the idle animation.

Since I’m testing the behavior of the NPCs, I configured them to generate a new customer every 2 seconds and when they reach the order area of ​​the restaurant or are seated after a certain amount of seconds they automatically move on to the next state.
I still don’t understand what could be generating the error. For this type of behavior, can AiPath be used or is it advisable to use another component? :thinking: :thinking: :thinking:

I appreciate your patience, help and any suggestions.

You should be able to use AiPath for this without issue, yeah. That’s weird- they all just suddenly stop pathfinding at once? Can you show us the relevant part of the StopMovementCharacterNPC method that stops them? Also can you send a screenshot of one of the AIPath components when they suddenly stop? Having the Debug Info expanded would help too :+1:

The next image shows the code:
In UpdateCheckIfReachedDestination() it checks if it has already reached the destination position to execute StopMovementCharacterNPC() where it executes the Idle animation, deactivating the movement and rotation of the AIPath.

In the next video I pause it when an NPC stops completely to see the inspector in debug mode.

AIPath in the inspector in normal mode and in debug mode.

A* in debug mode.

1 Like

Okay gotcha, thanks for that info. I’ve been digging into this, and I have a few questions:

  1. So you’re stopping them manually when they’ve reached their destination, then you’re manually un-stopping them when you want them to move again? And you’re doing this so that you can place an obstacle over them right?

  2. What makes them an obstacle after they stopped? Are they tagged in some sort of way that will carve the mesh or anything?

  3. Does this happen when you have RVO disabled on all your agents as well?

When the npc character reaches its target I disable movement and rotation with (AiPath.canMove = false and AiPath.enableRotation = false) so that it cannot move or be pushed.

For the new tests I recorded I commented all interaction with AiPath except AiPath.destination and AiPath.reachedDestination which are the most important.

For testing I assigned an npc to spawn every 1 second.
When I run the test with the RVOSimulator Disabled component, they do not stop and reach their target correctly, all the NPCs that could spawn in the test do so correctly.

When I run the test with the RVOSimulator Enabled component the problem occurs.

Note: NPCs have the mesh on the Default layer and have no colliders.

Well that’s weird .-. Are your AIPath components on objects that are parented to anything? Feel free to drop a project file of this and I can poke around, if you’d like.

I created a project but removed most of the things that are not necessary to analyze the problem, mainly because they are a large number of scripts that would make the project difficult to read.

I uploaded the project to drive, if you can please tell me what your email is so I can give you access or send me a private message even though I am new to the forum and I don’t know if can send private messages. :thinking: :thinking:

The scene is Base_WhiteBox and in the scene ObjectPoolingManager is responsible for spawning all the NPCs and NpcCharactersClientsManager is responsible for indicating to the NPCs the destination of their movements.

The next videos are the behavior in the simplified project:

Tables and chairs are spawned with another system, in itself the objects that are involved in indicating the movement destination are: NpcCharactersClientsManager.cs is the one that has the information of which points are occupied and which are available to be occupied by an NPC and EntityNPCCharacter.cs which is the one that has the AIPath.cs class to assign the destination.

Thank you very much for helping me, I really don’t understand what causes it but I trust that it is some small detail that I haven’t found.