简体   繁体   中英

Implementing ThreeJS Transform control to Autodesk Forge Viewer

I'm trying to include ThreeJS Transform control into my Forge Viewer, using this tutorial:

https://adndevblog.typepad.com/cloud_and_mobile/2015/08/moving-visually-your-components-in-the-viewer-using-the-transformtool.html

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 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM