I have a bootstrap modal to display a list of models.
I set draggable to modal. However everytime I move the modal, the camera also change.
My goal is just drag modal.
Here is https://codepen.io/nxhoang/full/vrxOxN/
You just need to change the line
controls = new THREE.OrbitControls(camera);
to
controls = new THREE.OrbitControls(camera, container);
Without the second argument in the constructor, OrbitControls listens for mouse events on the window
object - so if you click and drag anywhere, it will activate the control’s event listeners.
When you pass in the container
as the second parameter, the event listeners are set up on that instead, so mouse events on other elements are unaffected.
2 Likes
Wonderful, thank you so much