x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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: alt text

  • Here the player on the right side The "does path exist" fails. The patroller isn't moving to the player: alt text

  • Here the player on the left side The "does path exist" succeeds The patroller is moving to the player alt text

I don't know what to do...

Product Version: Not Selected
Tags:
spawn.png (301.1 kB)
fail.png (585.2 kB)
success.png (599.3 kB)
spawn.png (301.1 kB)
more ▼

asked Feb 05 '15 at 01:59 PM in Blueprint Scripting

avatar image

Nach
25 9 13 18

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered Feb 05 '15 at 02:49 PM

avatar image

MieszkoZ STAFF
7.4k 225 57 414

avatar image Nach Feb 05 '15 at 03:00 PM

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.

avatar image MieszkoZ STAFF Feb 05 '15 at 03:12 PM

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

--mieszko

avatar image Nach Feb 05 '15 at 03:24 PM

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: alt text

here is the AI jumping to reach the other platfomr: alt text

here is the AI reaching the player: ![alt text][3]

capture.png (545.5 kB)
jump.png (533.8 kB)
reached.png (505.6 kB)
reached.png (505.6 kB)
avatar image Nach Feb 05 '15 at 03:29 PM

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

avatar image Nach Feb 05 '15 at 04:36 PM

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) alt text

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: alt text

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

  • The AI reaches the player : alt text

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 alt text

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.

spawn.png (321.3 kB)
success.png (539.2 kB)
jump.png (562.0 kB)
land.png (572.3 kB)
fail.png (540.4 kB)
avatar image Nach Feb 06 '15 at 02:24 PM

any idea someone? ??

avatar image MieszkoZ STAFF Feb 06 '15 at 02:28 PM

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?

avatar image Nach Feb 06 '15 at 02:45 PM

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

avatar image MieszkoZ STAFF Feb 06 '15 at 02:50 PM

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.

avatar image Nach Feb 06 '15 at 02:57 PM

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

avatar image MieszkoZ STAFF Feb 06 '15 at 03:18 PM

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

avatar image Nach Feb 06 '15 at 03:32 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question