AI doesn't move to target

I’m using behavior tree to control my ai patroller.
The problem I have is that my patroller doesn’t move to the player as he sees him.
The decorator " does path exist" fails when the player is on the platform on which the patroller has not spawned
and it succeeds when the player is on the player is on the platform on which the patroller has spawned
I’m using the path query type “NavMesh raycast 2D” as I need the patroller stop if the player is not on the navmesh.
Here are some screen shot:

  • Here is where the patroller spawned:

  • Here the player on the right side
    The “does path exist” fails.
    The patroller isn’t moving to the player:

  • Here the player on the left side
    The “does path exist” succeeds
    The patroller is moving to the player

I don’t know what to do…

NavMesh Raycast 2D is a raycast on navmesh, which in your case fails due to there being a gap between AI and player (links don’t count). If you want some behavior to not happen when player is outside of navmesh you’ll need to implement a test that tries to project players location to navmesh and checks the result.

Cheers,

–mieszko

I understand what you mean then why the raycast succeeds in the third screenshot? The patroller was on the other platform and even if there was the gap between player and ai. The AI succeeds in moving to the player.

As far as I can see on the third screenshot player is on the same platform, just a bit above it (which is not a problem for navmesh projection). Unless I don’t know which one is the player :smiley:

–mieszko

Ok.
the player is on the left side, the ai is on the right side.
The ai was on the right platform, in the screenshot the AI is just jumping from the right platform to the left platform. Which mean the navmesh projection worked, as the AI moved to the player.

here is the position of the AI just before it jump to the other platform:

here is the AI jumping to reach the other platfomr:

here is the AI reaching the player:

][3]

Something to know is that the AI spawned on the left platform

Ok here is my problem with more details. I hope you’ll understand what I mean.

The player is the cat.
The AI is the dog he is patrolling between two target points (one is on the red platform and the other is on the brown platform) and he can jump.

The AI spawns on the brown platform (right one)

Case of success:

  • The AI is patrolling and he went to the red platform where he is standing.

  • The player is on the brown platform (where the AI has spawed)

  • The AI sees the player and move to him by jumping from the red platform to the brown platform.

  • The AI sees the player and the navmesh projection succeeds:

  • The Ai jump from the red platform to the brown platform:

  • The AI reaches the player :

Case of failure:

  • The AI is on the brown platform (on which he has spawned)
  • The player is on the red platform (where the AI has not spawned)
  • The navmesh projection doesn’t work

I hope now you know what I mean. The navmesh projection only works if the player is on the platform on which the AI has spawned.

any idea someone? ??

Have you tried using regular pathfinding in Does path exist decorator? Navmesh raycast works across your platforms only by chance (if it does at all). Can you double-check what is the value of Enemy key when the test is performed?

If I use the regular path finding the AI follow the player even if the player is outside the navmesh . That’s why I needed to use navmesh raycast 2D.
The enemy value is set to the player reference

Like I said, you might need to implement a custom test that checks if player is on the navmesh. We are currently working on changes that will allow users to specify whether a “partial path” is acceptable for them or not, but until then a custom test seems to be your way to go.

Is custom decorator triggering abort? I’m using the 4.6 version

BP implemented decorators prior 4.7 are not fully functional. C++ is fine.

Is there any example that show how to use project point to navigation in c++