Replies: 1 comment
-
Well,
Your solution seems totally fine and valid. I know connecting signals via code can seem hacky, but if it works it works!
This whole situation sounds like a case for a nested state machine like this: flowchart TB
Entry((Behaviour Tree)) -- Start Interacting Behaviour --> INTERACTING
subgraph Nested State Machine
INTERACTING -- onInteractionCompleted--> IDLE
INTERACTING -- onInteractionCanceled--> IDLE
end
IDLE -- onInteractionFinished--> Entry
Depending on who complex your interactions are, your approach may be more efficient tho. You would also implement some logic to go around
If you have any pointers on how that would work, go ahead and open an issue. I am currently working on another project, so I probably would revisit when I need this myself. |
Beta Was this translation helpful? Give feedback.
-
I've got some functionality in my project that involves waiting. In particular, I have an interactable item that takes time to complete the interaction. Within my behavior tree, my actor calls
scan()
(my method), whichawait
s with a timer.In an ideal workflow, I'd be able to
await
that function, but I can't because that's not how the code is structured. If I'm running this in aBTSequence
, then intick()
, the codevar response = leaves[current_leaf].tick(delta, actor, blackboard)
is the failure point, because it's not usingawait
for a function that usesawait
.That all makes sense and is perfectly reasonable. My workaround has been to not await the timer in the leaf calling
scan()
, but have it connect (on "first tick") to a signal the other code throws whenscan()
completes. Then I have to disconnect the signal before I returnBTStatus.SUCCESS
. Because there is no_on_enter()
concept for leaves, it just feels a little awkward, but maybe I'm doing something weird.So my question is, is there a better way to do this, or is that kind of just not how this works? It would be really convenient to have it be await-aware so I can basically suspend processing of the tree until
await
resumes.Beta Was this translation helpful? Give feedback.
All reactions