I'm having trouble with the orbit controller in my scene and here is the code I have:
import * as THREE from 'three'
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader'
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
import { CSS2DRenderer, CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
function addCamera() {
const camera = new THREE.PerspectiveCamera(
90,
window.innerWidth / window.innerHeight,
0.1,
1000
)
// Additional camera configuration...
return camera
}
function addLight(scene: THREE.Scene) {
// Light setup...
return scene
}
// More code for setting up the scene...
const controls = new OrbitControls(camera, renderer.domElement)
controls.target.set(10.0, 0.0, 0.0)
// Loading models...
window.addEventListener('resize', onWindowResize)
function onWindowResize() {
// Adjusting camera aspect ratio and updating renderer size...
}
function animate() {
// Animation loop...
}
function render() {
// Rendering the scene...
}
animate()
Is there anyone who can assist me with this issue?