speed vectors move with aagent

This commit is contained in:
STEINNI
2025-10-30 20:49:41 +00:00
parent e12e83c0e1
commit 0a59e92937
3 changed files with 35 additions and 14 deletions
-1
View File
@@ -125,7 +125,6 @@ class KeyframeView extends WindozDomContent {
}
onPropsChanged(evt, comp){
console.log('onPropsChanged', comp.name, comp.value)
if(this.currentlySelectedAid && this.kfArena.agents[this.currentlySelectedAid]){
const AgentValues = this.getFieldsValues('div[data-output="agentProperties"]')
this.kfArena.agents[this.currentlySelectedAid].values = AgentValues
+22 -6
View File
@@ -143,9 +143,10 @@ export class kfArena{
x: values.speed.x,
y: values.speed.z,
z:values.speed.y },
`_speed_${aid}`,
0xff0055)
{ name: `_speed_${aid}`,
color: 0xff0055,
scale: 0.5,
})
this.agents[aid] = {
type: typeId,
@@ -161,7 +162,10 @@ export class kfArena{
}
moveAgent(aid, position){
const obj3d = this.scene.getObjectByName(aid)
let obj3d = this.scene.getObjectByName(aid)
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)
.to({ x: Number(position.x),
y: Number(position.z),
@@ -169,6 +173,16 @@ export class kfArena{
}, 500)
.easing(TWEEN.Easing.Quadratic.InOut)
.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,
}, 500)
.easing(TWEEN.Easing.Quadratic.InOut)
.start()
}
}
changeAgentSpeed(aid, speed){
@@ -180,8 +194,10 @@ export class kfArena{
x: speed.x,
y: speed.z,
z: speed.y },
objName,
0xff0055)
{ name: objName,
color: 0xff0055,
scale: 0.5,
})
}
reloadAgents(agents){