I have successfully added a click event to the model loaded using Three.js, but I am facing issues with adding click events to specific parts of the uploaded model. For instance, while I can create a click event for the entire car model I imported, my goal is to trigger different actions based on where I click within the model - such as writing 'wheel' to the console when clicking on the wheel or 'glass' when clicking on the glass.
How can I achieve this level of interactivity?
const objLoader = new THREE.OBJLoader2();
objLoader.loadMtl('bugatti.mtl', null, (materials) => {
objLoader.setMaterials(materials);
objLoader.load('bugatti.obj', (event) => {
const root = event.detail.loaderRootNode;
scene.add(root);
myModel = root;
const domEvents = new THREEx.DomEvents(camera, renderer.domElement)
domEvents.addEventListener(myModel, 'click', event => {
console.log("car");
});