So I've just started using this plugin. I watched all the tutorial vids and downloaded the sample projects and then I tried to start with a simple tree which is attached to a car. The car moves forward at all times, and all this tree is supposed to do is make it so when the car is behind the player, its speed is set to be faster than the player. Once the car is no longer behind the player, its speed is set to be slower than the player. The catch is that I need the car's state (whether it's behind the player) to be constantly reevaluated. That is, once the car gets ahead of the player, if it later gets behind him again, it should speed up again. If it then gets ahead of him again, it should slow down again. The following picture is one of the many attempts I've tried at this:
What happens here is that the car starts behind the player, sets the speed to be faster than the player, and then passes him but doesn't slow down. This is despite the sequence being set to "lower priority", which I thought was supposed to make IsBehind constantly get reevaluated. I've tried many things, including setting the selector to "low priority" on top or instead of the sequence, adding an idle node at the end of each state, reading the documentation again and again, replacing the Set Field Value tasks with ones that set the speed every frame and are always running, and mimicking the following tree from the sample CTF game which I *think* does what I want (it can go to seek, then to defend, then back to seek, and so on):
The only thing that worked was putting the entire tree under a repeater. I'm new to this plugin so I can be wrong, but my understanding is that that is a very inefficient and terrible idea and it will probably cause me many troubles later when I start expanding this tree with more complex behaviors. I'm under the impression that conditional aborts are supposed to solve my problem.
I think my problem here is that I don't understand how the control flow works in Behavior Designer. All the documentation says is that it goes "top to bottom, left to right". But like, do trees run once to completion and then totally exit or do they run forever? If a condition returns success once, then changes to failure, then back to success, will it issue an abort? If it does and you go back to a branch that you were already on before, does it start from the beginning again, or where you left off?
Some help with my little beginner tree and an explanation of how Behavior Designer decides which task to run at any given time other than "top to bottom, left to right" would be appreciated. Thanks.
What happens here is that the car starts behind the player, sets the speed to be faster than the player, and then passes him but doesn't slow down. This is despite the sequence being set to "lower priority", which I thought was supposed to make IsBehind constantly get reevaluated. I've tried many things, including setting the selector to "low priority" on top or instead of the sequence, adding an idle node at the end of each state, reading the documentation again and again, replacing the Set Field Value tasks with ones that set the speed every frame and are always running, and mimicking the following tree from the sample CTF game which I *think* does what I want (it can go to seek, then to defend, then back to seek, and so on):
The only thing that worked was putting the entire tree under a repeater. I'm new to this plugin so I can be wrong, but my understanding is that that is a very inefficient and terrible idea and it will probably cause me many troubles later when I start expanding this tree with more complex behaviors. I'm under the impression that conditional aborts are supposed to solve my problem.
I think my problem here is that I don't understand how the control flow works in Behavior Designer. All the documentation says is that it goes "top to bottom, left to right". But like, do trees run once to completion and then totally exit or do they run forever? If a condition returns success once, then changes to failure, then back to success, will it issue an abort? If it does and you go back to a branch that you were already on before, does it start from the beginning again, or where you left off?
Some help with my little beginner tree and an explanation of how Behavior Designer decides which task to run at any given time other than "top to bottom, left to right" would be appreciated. Thanks.