Get Remaining Distance Requires 'Wait' Task?

AntL

Member
Hi there, I'm building a tree that moves an agent towards a point in the world. When it gets within a range of that point, I want it (for the moment) to output a message.
The problem I'm having is the following. If I run the tree as is, it moves through as expected but the Get Remaining Distance task reports 0 distance. This means it moves through each task and hits the Log Task on the first execution of the tree. After which, the Get Remaining Distance seems to wake up, return the correct distance to the target point and the tree behaves as expected.

The only way I can seem to resolve this is to enable the 'Wait' task (currently 1 second), so the Get Remaining Task has time to calculate the the distance to the point. It then works perfectly.

I'm imagining I'm screwing up here somewhere, any advice would be most welcome!

Thanks
Ant
 

Attachments

  • Capture.PNG
    Capture.PNG
    100.4 KB · Views: 2
I think the navmesh is being created in the background so it's not ready at that time. You could try waiting a frame by deselecting "Instant" on the Set Destination task so the tree will wait a tick.
 
Top