"Is At Location" decorator is broken

Hi,

I am currently having 2 big problems with the “Is At Location” decorator in Behaviour trees.

  1. The decorator will no longer let me use any Object/Actor blackboard keys, except the engine default ‘SelfActor’. I used to be able to check whether my AI was at location of the ‘Target’ actor, which is still in the blackboard (see image), but the Blackboard Key dropdown will not let me use it anymore. It only displays vectors and the aforementioned ‘SelfActor’. This means that everywhere I want to use that node, now I need a service that will read ‘Target’ actor’s location and store it in ‘TargetLocation’ vector, as well as as rendering options such as 'Use Nav Agent Goal Location" completely useless.

  2. Second issue is that the node now always returns false (True for inversed) no matter the AI’s location, the target location or the distance set. On the image you can see that the acceptable radius is set to 1000, so my creature should detonate as soon as its distance to ‘TargetLocation’ is less than that. For evidence I made a service that calculates that distance and stores it in the blackboard too. As you can see, the distance is 96.47, way less than 1000, but the “Is at Location” is still returning “false”

Kind regards,

Marcin

Hey Marcin,

IsAtLocation decorator uses pathfinding code to determine the result of the test. In my tests it works just fine, but I can imagine it going wrong - as part of the test pathfinding code also checks the Z-distance to goal location, so with unfortunate scales and navmesh generation it can fail. Z-acceptance should be exposed as a parameter of the decorator as well. I’ll file a ticket for it.

Regarding Actors-keys missing from BB dropdowns, make sure your BB object keys have object class set to Actor - it defaults to Object and we some (most) of our BB dropdowns are restricted to using only vectors and actors.

Cheers,

–mieszko

1 Like

Hi Mieszko,

The Object to Actor advice is gold, I’m disappointed that I didn’t think of it myself. As for the test result, I fully acknowledge that I don’t know enough about the inner workings of the node (the tooltip suggests a simple distance check, no documentation could be found), but In the situation I am having, neither the pathing nor the Z difference should be failing.

]

Here’s the screenshot of it. The Cone AI (radius=34) is checking whether its within 1000 units of the TopDownCharacter (radius=42) and failing. The floor is perfectly flat, there is plenty of navmesh and the Z difference between actor locations of those two characters is 7 units. The 3D distance between actor locations in this picture is 102 units.

I hope this help, if not nail down exact cause, at the very least rule out some red herrings.

The image seems to support my suspicion. What if you moved the cone down so that it stands on the floor? Navigation agent’s collision height plays a role in the test as well. If you confirm that’s the issue here I’ll show you how to change decorator’s code to fix it :slight_smile:

The decorator obviously is missing some information - it should clearly state it’s using pathfollowing tests, that are not simple 3d distance comparisons.

Hi Mieszko,

Thank you for the reply. The character already is standing on the floor. The cone is just a visual mesh and should not affect how the character behaves in any way. Here’s a more accurate representation of the character’s capsule (I shrunk the cone more for further visibility).

Navigation agent’s collision height plays a role in the test as well.

What role is that? Is it “the taller my agents, the higher I need to set my acceptable radius”?

If you confirm that’s the issue…

If “that” refers to the character floating above ground than it is definitely not the issue here.
If “that” refers to “agent’s collision height” than all i can say is that:

  • my nav mesh agent height is set to 200
  • player character is 192 units tall
  • cone character is 176 units tall

But since I don’t know what role the agent height plays in this issue I am afraid I don’t know how to use these numbers to confirm anything at this point. I still cannot see any numbers that would amass to a value greater than 1000 in order for the decorator to fail.

I’ll show you how to change decorator’s code to fix it

Does this mean you are now in agreement with me that the decorator is in fact broken?

Kind regards,

Marcin

Does this mean you are now in agreement with me that the decorator is in fact broken?

I meant that if Z-axis testing is the culprit here I can show you how to expose it to be configurable via Is At Location decorator’s properties.

What you describe sounds like an easy to debug issue. Go to UPathFollowingComponent::HasReachedInternal and check which one of the two conditions fail. Please let me know which one was it :smiley:

Cheers,

–mieszko

Hi Mieszko,

Unfortunately I am a blueprint developer, so I am at the mercy of the tools you guys expose for me and I cannot look into the code for you. Would you like me to send you an example project?

Kind regards,

Marcin

Yeah, if I had a repro project I could easily address the issue. The fix will be on the code side obviously, so you’ll need a programmer to apply it for you. Or wait for the next engine version or use Master branch.

Hi Mieszko,

Here’s the example project I promised

Project

I made a new lightweight one and with it a few changes. I used a movable TargetActor to get my TargetLocation instead on a character for this one. I noticed that if I put it directly on the navmesh, the decorator will in fact work, but if I move it up a bit, it will stop. I guess that’s the Z you were talking about.

I see now why you claimed that the node is working as intended, however I hope you see why from the user’s perspective it seems completely broken.

Kind regards,

Marcin

Yeah, just as I suspected. It’s the z-distance that’s making the test fail. I’ll add comments making clear how the decorator works, but I’ll also add and alternative testing mode using regular 3D-distance, which is what most people would expect. I’ll even make that mode the default one.

For now there’s couple of ways to address that on your end.

  1. Create a decorator class derived from UBTDecorator_IsAtLocation and override CalculateRawConditionValue function and make it use regular 3D distance. This solution requires a programmer assistance but is most reliable.
  2. Create game specific implementation of PathfollowingComponent and set MinAgentHalfHeightPct to something move than 1.05 (the higher the value the more relaxed will the test be in terms of Z-distance). Note that this will affect all of pathfollowing’s tests. Again, this requires a programmer.
  3. Make sure locations you test against are on navmesh - that’s what pathfollowing code expects. You can project your test location to navmesh, or if those are pawns just use their feel location.
  4. Extend your AI’s height - pathfollowing test is reading that information while determining test results.

Hope it helps.

Cheers,

–mieszko