-
the selector and sequence node did not save running child index,so next tick will restart tick children? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Let's say I have a
And a Behavior Tree composed of the following nodes:
Now, an enemy comes into the field of view, so the first check succeeds, which means the task is executed, which change the state machine's state. The enemy is not yet in attack range, so the second check is still Next tick, the enemy is still into the field of view, so the first check succeeds, the first task transitions the state machine (which is a no-op since it is already in that state), then the second check is executed. The enemy is now in attack range, so the check succeeds and we move on to the second task which transitions the Next tick, there is no enemy in the field of view, so the first check returns TL;DR: To maintain state between ticks, I'd use a state machine given to the behavior tree via its "world" data structure. I hope it answers your question 🙂 |
Beta Was this translation helpful? Give feedback.
-
Also, moving this to a discussion rather than an issue. |
Beta Was this translation helpful? Give feedback.
Let's say I have a
CharacterController
state machine with the following states:And a Behavior Tree composed of the following nodes:
SUCCESS
, elseFAILURE
CharacterController
to stateMoving Towards Enemy
, thenSUCCESS
SUCCESS
, elseRUNNING
CharacterController
to stateAttack Enemy
, thenRUNNING
Now, an enemy comes into the field of view, so the first check succeeds, which means the task is executed, which change the state machine's state. The enemy is not yet in attack range, so the second check is still
RUNNING
, therefore …