Recently, I created a mini solar system project using three.js. Each planet is represented by an imported model in the scene. My goal is to make each planet clickable so that when clicked, the camera zooms in on the selected planet and displays the latest image of it next to the 3D model.
The main question here is: How can I add functionality to make the imported models clickable?
I attempted to implement raycasting for this purpose, but unfortunately, I have not been successful so far. It's all quite messy at the moment.
Below is the code snippet of what I've done up until now:
import * as THREE from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
// Remaining code included here...