bz-toggler
This commit is contained in:
@@ -4,11 +4,11 @@ import * as TWEEN from '/app/thirdparty/Three/tween.module.js'
|
||||
|
||||
export class AgentPreview{
|
||||
|
||||
constructor(canvasEl, agentDefs){
|
||||
constructor(canvasEl, agentSprites){
|
||||
Object.assign(this, app.helpers.helpers3D)
|
||||
this.agentDefs = app.Assets.Store.json.agentDefs
|
||||
this.agentSprites = app.Assets.Store.json.agentSprites
|
||||
this.canvasEl = canvasEl
|
||||
this.agentDefs = agentDefs
|
||||
this.agentSprites = agentSprites
|
||||
this.currentAgentObj = null
|
||||
this.renderer = null
|
||||
this._animation = false
|
||||
@@ -41,11 +41,13 @@ export class AgentPreview{
|
||||
this.renderer.render(this.scene, this.camera)
|
||||
}
|
||||
|
||||
setAgent(atype){
|
||||
setAgent(id){
|
||||
if(this.currentAgentObj && (this.scene.children.includes(this.currentAgentObj))){
|
||||
this.scene.remove(this.currentAgentObj)
|
||||
}
|
||||
this.currentAgentObj = this.agentFromJSON('previewedAgent', this.agentDefs[atype])
|
||||
const agentSprite = this.agentSprites.find(item => item.atp_id==id)
|
||||
if(!agentSprite) return
|
||||
this.currentAgentObj = this.agentFromJSON('previewedAgent', agentSprite.asp_3d)
|
||||
this.currentAgentObj.position.set(0, 0, 0)
|
||||
this.scene.add(this.currentAgentObj)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user