I’m trying to find an event driven way to know when a state completes (skelanim clip or motion matching), or when a transition begins in the animation graph state machine. I suspect polling is the only way, but hopeful I’m missing something.
I’d prefer to be able to do this directly in a behavior script but I’m open to the action graph if necessary.
In the case where event driven is not possible, any other ideas for a performant way to get current state would be much appreciated.
I was hoping that character.is_node_active() would give me the state, but so far it does not seem to work on state machine nodes, it always returns ‘false’ unless I’m using it incorrectly.
def on_update(self, current_time: float, delta_time: float):
# Initialize
if not self.character:
self.character = ag.get_character(str(self.prim_path))
if not self.character:
return
else:
self.full_initialize()
# Test is_node_active() using relative paths.
idle_active = self.character.is_node_active("StateMachine/Idle")
pick_active = self.character.is_node_active("StateMachine/Pick")
carb.log_info(f"Idle active: {idle_active}, Pick active: {pick_active}")