Repository navigation
How to transition between child and parent states in HSM? #249
Answered
by
limbonaut
drvelociraptor
asked this question in
Q&A
|
Basically I have a movement state and an attack state as a child. I want to change from movement to attack and viceversa. Can this be done? It seems add_transition just works with direct child states, and change_active_state gives me this error: "Unable to perform transition to a state that is not a child of this HSM."... Don't know what to do because I can't find anything on the docs, all examples seem to be for basic FSM. |
Answered by
limbonaut
Nov 14, 2024
Replies: 1 comment 8 replies
|
Can you provide an example of your state hierarchy? |
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

LimboStateis not a composite state, so it cannot contain other states as children (you could use class inheritance instead if you want to share some functionality). Adding more states under vanillaLimboStatenot going to work. AndLimboHSMis a composite that can have exactly one child substate active. We call it active substate. Think of it like a switch - only one of the children states is allowed to be active. And this is what transitions do - switch the active substate on a level.LimboHSMis a state itself (inherits fromLimboState), so you can nest them like so: