Load KF works
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user