Creating agent types

import Atoms
import AtomsCore
from Atoms import GLOBAL_NAMES

AGENT_TYPE = GLOBAL_NAMES.AGENT_TYPE

skeletonPath = "/path/to/skelfile.atomsskel"
geoPath = "/path/to/geofile.geos"
skinPath = "/path/to/skinfile.geos"

skel = AtomsCore.Skeleton(1)
skeletonArchive = AtomsCore.Archive()

if skeletonArchive.readFromFile(skeletonPath):
	skel.deserialise(skeletonArchive)    

aType = Atoms.AgentType()
aType.setSkeleton(skel)

meshMap = AtomsCore.MapMetadata()
typeArchive = AtomsCore.Archive()
if typeArchive.readFromFile(geoPath):
	meshMap.deserialise(typeArchive)
	aType.metadata()[AGENT_TYPE.LOW_GEO] = meshMap

skinMap = AtomsCore.MapMetadata()
skinArchive = AtomsCore.Archive()
if skinArchive.readFromFile(skinPath):
	skinMap.deserialise(skinArchive)
	aType.metadata()[AGENT_TYPE.SKIN_GEO] = skinMap

aType.metadata()[AGENT_TYPE.STATE_MACHINE] = AtomsCore.StringMetadata("StateMachine") # StateMachine should be a valid state machine name
aType.metadata()[AGENT_TYPE.SCALE_MULTIPLIER] = AtomsCore.DoubleMetadata(1.0)

Atoms.AgentTypes.instance().addAgentType("testAgentType", aType)

Copyright © 2017, Toolchefs LTD.