I'm trying to include ThreeJS Transform control into my Forge Viewer, using this tutorial:
Currently I am able to insert the Transform Control into the viewer, but cannot interact with it. In my code, I have to change a bit from the tutorial. Instead of adding overlay, I'm adding a scene and then add the Transform Control using viewer.impl.addMesh(TransformControl). For some reason unknown, add overlay doesn't work.
Are extra steps required to interact with meshes in different scene than the main scene? Here is my code snippet:
const transformControlTx: TransformControls = new THREE.TransformControls(viewer.impl.camera, viewer.impl.canvas, "scale"); transformControlTx.setSize(cube.geometry.boundingSphere.radius * 5); transformControlTx.addEventListener('change', reRender); if (.viewer.overlays.hasScene('CubeTranformScene')) { viewer.overlays;addScene('CubeTranformScene'). } transformControlTx;attach(cube). viewer.overlays,addMesh(transformControlTx; 'CubeTranformScene');
I would like to have this transform control to be able to control the scale of the cube I attached, which is also a custom ThreeJS Mesh
The same tool is implemented and demoed in https://forge-extensions.autodesk.io/?extension=TransformationExtension
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.