bz-toggler

This commit is contained in:
STEINNI
2025-10-20 14:33:13 +00:00
parent d0ca65a435
commit 2ff7bf9b8a
11 changed files with 272 additions and 26 deletions
@@ -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)