Behaviour tree communication

Is there a way to call events from behaviour tree when for instance sensing component sees any pawn so its like this :
sensing interval happens-> sees object-> communicates to behaviour tree to decide on action.

Kinda. The recommended way is to set values in your AI’s Blackboard and in BT have decorators observing related blackboard keys. The BTDecorator_Blackboard is what you can use for it. UE4 4.7 makes that functionality available to BP-implemented decorators as well.

Cheers,

–mieszko

If I use sensing component mostly to set an array of actors seen and then want to decide what to do with them in Behaviour Tree, is it better for me to do it totally in BT by some sort of tracing instead of sensing? Curious if it can cause some problems that there’s an interval for sensing component and separate interval in BT to check values.

In the end implementation details are up to you. But the the recommended way of communicating with behavior tree from outside world is via Blackboard. Is there a good reason you don’t want to use it? If you need some guidance let us know.

I understand that I can write information that sensing component provides to Blackboard, my problem well not exactly problem rather a concern is that my goal is to make instantaneous reaction when sensing component gets information->writes it to BB-> decides depending on conditions. I dont really understand yet how the BT works and I thought that I can only set interval in BT that checks for conditions so it looked to me like there are 2 separate intervals checking the same thing, why not rewrite what sensing component does for me to BT node so it checks the info just once.

The biggest advantage of using blackboard with your BT is that you don’t have to poll conditions. If you use BB-observing decorator and set it to influence control flow (FlowAbortMode != None) your BT will get notified about condition value or BB value changes.

This is a concept unique to UE4’s Behavior Tree implementation - I strongly encourage you to give it a try since we’ve build a lot of functionality with this workflow in mind.

Don’t know if it helps, i also use pawn sensing component. In my implementation i use a bb variable too. I set the bb variable in the onSeePawn delegate function. so it would fill the bb variable instantenously(not that kind of instantenously, but at least it would fired up when my pawn see actor), and then i use decorator to check the condition. I mean there is no check interval, whatsoever…

I will definetly try that.
So tell me if I understand that good: decorator can be set to notice if value has changed?

Yes, just set Observer aborts to something else then None.

Thanks to both of you for clarification.