baseplane, root-object offset, saveKF & resetKF buttons...
This commit is contained in:
@@ -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
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user