baseplane, root-object offset, saveKF & resetKF buttons...

This commit is contained in:
STEINNI
2025-10-21 15:55:22 +00:00
parent 36776162ec
commit aa76bfe9c0
6 changed files with 67 additions and 14 deletions
+11 -2
View File
@@ -8,10 +8,9 @@ if(!app.helpers) app.helpers = {}
app.helpers.helpers3D = {
agentFromJSON(id, desc){
let obj
let obj, wrapper
if(desc.type === 'Mesh') {
const geom = new THREE[desc.geometry.type](...(desc.geometry.args || []))
const matType = desc.material.type
const matProps = { ...desc.material }
for (const key in matProps) {
@@ -26,7 +25,16 @@ app.helpers.helpers3D = {
}
const mat = new THREE[matType](matProps)
obj = new THREE.Mesh(geom, mat)
if(desc.translate){
wrapper = new THREE.Object3D()
wrapper.add(obj)
obj.position.x = desc.translate[0]
obj.position.y = desc.translate[1]
obj.position.z = desc.translate[2]
}
} else if(desc.type === 'Group') {
obj = new THREE.Group()
} else {
@@ -45,6 +53,7 @@ app.helpers.helpers3D = {
obj.add(this.agentFromJSON(childId, childDesc))
})
}
if(wrapper) obj=wrapper
obj.name = id
return obj
},