Access agent data (AtomsUnreal)
Â
AtomsPtr<Atoms::AgentGroup> agent_group = Cast<AAtomsAgentGroup>(Actor);
//get agent from the agent group
auto& agents = agent_group->agents()
Atoms::Agent* agent = agents[0];
//get agent from the agents pool
agent = Atoms::AgentsPool::instance().agent(0);
// get agent pose object
AtomsCore::Pose& pose = agent->pose();
// get agent type
AtomsPtr<const Atoms::AgentType> agent_type = agent->agentType();
// get he skeleotn
AtomsCore::Skeleton& skeleton = agent_type->skeleton();
// get the pose from the agent
AtomsCore::Poser poser(&agent_type->skeleton());
auto matrices = poser.getAllWorldMatrix(pose);
// get agent metadata
AtomsPtr<AtomsCore::MapMetadata>& agent_metas = agent.metadata();
//get agent group id
int groupId = agent_metas->getTypedEntry<AtomsCore::IntMetadata>("groupId")->get();
// or the faster version
groupId = agent->groupId()->get();
// get agent direction
AtomsCore::Vector3 direction = agent_metas->getTypedEntry<AtomsCore::Vector3Metadata>("direction")->get();
// or the faster version
direction = agent->direction()->get();
// get agent position
AtomsCore::Vector3 position= agent_metas->getTypedEntry<AtomsCore::Vector3Metadata>("position")->get();
// or the faster version
direction = agent->position()->get();
Copyright © 2017, Toolchefs LTD.