fixed move selected + multi tween bugs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as THREE from 'three' // '/app/thirdparty/Three/three.module.js'
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js' // '/app/thirdparty/Three/OrbitControls.module.js'
|
||||
import * as TWEEN from 'three/examples/jsm/libs/tween.module.js' //'/app/thirdparty/Three/tween.module.js'
|
||||
import * as THREE from 'three'
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'
|
||||
import * as TWEEN from 'three/examples/jsm/libs/tween.module.js'
|
||||
|
||||
export class kfArena{
|
||||
|
||||
@@ -161,23 +161,27 @@ export class kfArena{
|
||||
}
|
||||
|
||||
moveAgent(aid, position){
|
||||
let obj3d = this.scene.getObjectByName(aid)
|
||||
const obj3d = this.scene.getObjectByName(aid)
|
||||
this.clearHighlight3DObj(obj3d, this.scene)
|
||||
const dx = Number(position.x) - obj3d.position.x
|
||||
const dy = Number(position.z) - obj3d.position.y
|
||||
const dz = Number(position.y) - obj3d.position.z
|
||||
new TWEEN.Tween(obj3d.position)
|
||||
if(this.moveAgentTween) this.moveAgentTween.stop()
|
||||
this.moveAgentTween = new TWEEN.Tween(obj3d.position)
|
||||
.to({ x: Number(position.x),
|
||||
y: Number(position.z),
|
||||
z: Number(position.y),
|
||||
}, 500)
|
||||
.easing(TWEEN.Easing.Quadratic.InOut)
|
||||
.onComplete(() => { this.highlight3DObj(obj3d, this.scene) } )
|
||||
.start()
|
||||
obj3d = this.scene.getObjectByName(`_speed_${aid}`)
|
||||
if(obj3d){
|
||||
new TWEEN.Tween(obj3d.position)
|
||||
.to({ x: obj3d.position.x + dx,
|
||||
y: obj3d.position.y + dy,
|
||||
z: obj3d.position.z + dz,
|
||||
const arrow3d = this.scene.getObjectByName(`_speed_${aid}`)
|
||||
if(arrow3d){
|
||||
if(this.moveArrowTween) this.moveArrowTween.stop()
|
||||
this.moveArrowTween = new TWEEN.Tween(arrow3d.position)
|
||||
.to({ x: arrow3d.position.x + dx,
|
||||
y: arrow3d.position.y + dy,
|
||||
z: arrow3d.position.z + dz,
|
||||
}, 500)
|
||||
.easing(TWEEN.Easing.Quadratic.InOut)
|
||||
.start()
|
||||
|
||||
Reference in New Issue
Block a user