/
Check if an agent is in a transition

Check if an agent is in a transition

Maya

import Atoms

smi = Atoms.StateMachines.instance()

from AtomsMaya.hostbridge.atomsgroup import MayaAtomsGroupHostBridge
from AtomsMaya.hostbridge.commands import MayaCommandsHostBridge

nh = MayaAtomsGroupHostBridge()
nh.set_app_obj("tcAgentGroupNodeShape1")

ag = nh.get_agent_group()

ids = ag.agentLocalIds()

for agent_id in ids:
    agent = ag.agent(agent_id)
    sm = smi.stateMachine(agent.agentType().metadata()["stateMachine"].value())
    if not  sm:
        continue

    state = agent.metadata()["state"].value()
    current_state = agent.metadata()["currentState"].value()

    if current_state != state:
        print(sm.connections()[(current_state, state)].name())

Houdini

import Atoms

smi = Atoms.StateMachines.instance()

from AtomsHoudini.hostbridge.atomsgroup import HoudiniAtomsGroupHostBridge
from AtomsHoudini.hostbridge.commands import HoudiniCommandsHostBridge

nh = HoudiniAtomsGroupHostBridge()
nh.set_app_obj("/obj/AgentGroupName")

ag = nh.get_agent_group()

ids = ag.agentLocalIds()

for agent_id in ids:
    agent = ag.agent(agent_id)
    sm = smi.stateMachine(agent.agentType().metadata()["stateMachine"].value())
    if not  sm:
        continue

    state = agent.metadata()["state"].value()
    current_state = agent.metadata()["currentState"].value()

    if current_state != state:
        print(sm.connections()[(current_state, state)].name())

Related content

State machine debugger data
State machine debugger data
More like this
Iterating through the agents of an agent group
Iterating through the agents of an agent group
More like this
Creating agent groups
Creating agent groups
More like this
Agent Aim
More like this
Behaviour module handling
Behaviour module handling
More like this
Reading the world joint matrices of an agent
Reading the world joint matrices of an agent
More like this

Copyright © 2017, Toolchefs LTD.