I noticed that in the speckle-server repository, there’s a snippet of code in the Sandbox.ts file that is used for moving the entire model via a URL.
However, it seems that only the model’s matrix was changed, and the model in the viewer was not moved to the specified position, meaning that it is not possible to accurately point to the model.
Is there a way to correctly move the entire model, or to load the model at specified coordinates
private addStreamControls(url: string) {
const folder = this.tabs.pages[0].addFolder({
title: `Object: ${url.split('/').reverse()[0]}`
})
folder.addInput({ url }, 'url', {
title: 'URL',
disabled: true
})
const position = { value: { x: 0, y: 0, z: 0 } }
folder.addInput(position, 'value', { label: 'Position' }).on('change', () => {
const subtree = this.viewer.getRenderer().subtree(url)
subtree.position.set(position.value.x, position.value.y, position.value.z)
this.viewer.getRenderer().updateDirectLights()
this.viewer.getRenderer().updateHelpers()
this.viewer.requestRender()
})
folder
.addButton({
title: 'Unload'
})
.on('click', () => {
this.removeStreamControls(url)
})
this.streams[url] = []
this.streams[url].push(folder)
}