I use the Draw Tool Extension to create objects in my scene. But they are created simply as three objects.js. I want them to be clickable and be part of the Autodesk Forge Viewer model. I’m new to Forge, and I don’t understand how to do it or where to read about it at all.
This is how I create objects. This is where I took the extension that I use https://github.getafreenode.com/autodesk-platform-services/aps-extensions/blob/main/public/extensions/DrawToolExtension
// If left button is pressed and we're not drawing already
if (button === 0 && this.state === '') {
// Create new geometry and add it to an overlay
if (this.mode === 'box') {
const geometry = new THREE.BufferGeometry().fromGeometry(new THREE.BoxGeometry(1, 1, 1));
const material = new THREE.MeshPhongMaterial({ color: 0x44bbff });
this.mesh = new THREE.Mesh(geometry, material);
} else {
const geometry = new THREE.BufferGeometry().fromGeometry(new THREE.CyclinderGeometry(0.5, 16, 16));
const material = new THREE.MeshPhongMaterial({ color: 0x44bbff });
this.mesh = new THREE.Mesh(geometry, material);
}
this.viewer.impl.addOverlay(DrawToolOverlay, this.mesh);
// Initialize the 3 values that will control the geometry's size (1st corner in the XY plane, 2nd corner in the XY plane, and height)
this.corner1 = this.corner2 = this._intersect(event.clientX, event.clientY);
this.height = 0.1;
this._update();
this.state = 'xy'; // Now we're drawing in the XY plane
return true; // Stop the event from going to other tools in the stack
}
// Otherwise let another tool handle the event, and make note that our tool is now bypassed
this.bypassed = true;
return false;
} ```