Load KF works

This commit is contained in:
STEINNI
2025-10-29 17:41:29 +00:00
parent f349ff38f4
commit dfab013abe
8 changed files with 105 additions and 21 deletions
+15 -2
View File
@@ -124,9 +124,12 @@ export class kfArena{
}
addAgent(typeId, aid, properties, values){
addAgent(typeId, aid, properties, values){ console.log('==addAgent==>',typeId, aid, properties, values)
const agentSprite = this.agentSprites.find(item => item.atp_id==typeId)
if(!agentSprite) return
if(!agentSprite) {
console.warn(`No sprite for type: ${typeId}`)
return
}
const agentObj = this.agentFromJSON(aid, agentSprite.asp_3d)
agentObj.position.set(values.position.x, values.position.z, values.position.y )
@@ -146,6 +149,16 @@ export class kfArena{
if(aid in this.agents) delete(this.agents[aid])
}
reloadAgents(agents){
for(const aid in this.agents){
this.removeAgent(aid)
}
console.log('====>', agents)
for(const agent of agents){
this.addAgent(agent.ekfs_atp_id, agent.aid, agent.props, {...agent.gps_values, ...agent.store_values})
}
}
// getAllAgents(){
// const agents = []
// scene.traverse(o => o.name && names.push(o.name))