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:
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.
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
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:
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.
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.