IsNavigationFinished() never returns true

I’m having some difficulty with this one. When my enemy makes it to the destination point, the 3d agent never indicates that navigation has finished. I found if I increase the Desired Distance variables, it sort of works, but then the enemy stops far away from the path node. Not sure what I’m missing here.

Here’s some debug output when it’s right on top of the target location but still not considered finished:
image

If I increase the desired distance it works but the distance is stops at doesn’t match the desired distance I set:
image

How can I make it actually stop when it’s supposed to? My current EnemyReturnState physics process method looks like this:

    public override void _PhysicsProcess(double delta)
    {
        GD.Print("Disatance to Target: " + characterNode.AgentNode.DistanceToTarget());
        GD.Print("Path Desired Distance: " + characterNode.AgentNode.PathDesiredDistance);
        GD.Print("Target Desired Distance: " + characterNode.AgentNode.TargetDesiredDistance);
        GD.Print("Is Finished: " + characterNode.AgentNode.IsNavigationFinished());
        if(characterNode.AgentNode.IsNavigationFinished())
        {
            characterNode.StateMachineNode.SwitchState<EnemyIdleState>();
            return;
        }

        characterNode.Velocity = characterNode.GlobalPosition.DirectionTo(destination);

        characterNode.MoveAndSlide();
    }

Hi GreenestBanana,

I am sorry you are having issues with this lecture.
The first thing that comes to mind that tripped me up with this was that my destination point was actually below the actual floor so i had to remember to pull it up a bit so it was in the correct position.

At which point in the video did this become an issue? This might help us pin down the issue as to why its not working as in the course as the code appears to be correct.

It was around 4:30 in the video I think. The “Reached Destination” routine wouldn’t activate for me.

I moved on and it seemed to start working when I called characterNode.AgentNode.GetNextPathPosition in _PhysicsProcess, though.

That is rather odd,
I would keep an eye on it and if any problems pop up again let us know and i will be happy to take a look.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms