Moving between actors using move to actor fails

I set up a logic that a character moves to a resource actor, picks up an item and brings it to a storage actor. This logic is repeated constantly.

  1. I set an actor variable later used in the AI where the character shall move to.

313006-initialize-movement.png

  1. This is then used in a custom move to task as follows:

  1. As soon as the character overlaps with a box placed around the goal actor, this event is triggered. This process is exactly the same for the movement to the resource and to the storage.

For the first “loop”, this works correctly but after the character delivered the item to the storage, it just stays in place and does not want to move anymore. Through debugging, I found that the “move to location or actor” node in step 2 constantly fails. The actor transmitted is the same as before and since there are no other parameters, I see no reason why it should fail now.

I also tried with simple move to actor, with the same observations.

The last node you have after the begin overlap is a “stop active movement”. you disable the movement this way. You then have to set the movement again by using the set movement node.

See here:

Thanks for the hint but this did not work. Also, printing the movement mode before and after stop active movement, it both times said “Walking” so I assume that the stop active movement only resets the movement but not the movement mode.

Regarding your behavior tree comment above: I am running this in a behavior tree task. I don’t use the standard move task since my character can either move to an actor or to a location (in other scenarios) and I want to have a proper logic to separate those cases properly. Since a lot of user intervention is possible, I also don’t want to rely on closed processes and prefer to use state machines.

Btw. consider using a behavior tree here. It will make your life much easier, since you try to move somewhere, do something, and move somewhere else etc.
A behavior tree sequence is a much easier approach than “programming it all by hand”.

Was testing around some more and found that the active pathfinding is the setting causing issues.

When the character picks up a resource, the static mesh of the resource actor changes and the navmesh automatically updates. After those changes, the character is not able to move to the resource anymore.
This behavior changes if I move the resource far away from other objects even though the navmesh already marks the area between those objects green. Even if there is navigation all around the resource, the second movement does not work if it is too near to other objects.

Example with the navigation before first resource takeaway and after it:

313315-nav-before.png

313316-nav-after.png

If you dont want the resource to change the navigation, you can disable “can affect navigation” in the actor details.

1 Like

That is possible but as a result, characters would try to walk e.g. through the resources, resulting in generally bad pathfinding and a lot of manual path correction. I could also keep the resource mesh as it is until everything was harvested but then the visual indication of the harvest would be lost.