I've created a function to prevent the rotation of a three.js object when the mouse hovers over it.
function onDocumentMouseUp( event ) {
event.preventDefault();
mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
raycaster.setFromCamera( mouse, camera );
var intersects = raycaster.intersectObjects( scene.group );
if ( intersects.length > 0 ) {
if ( INTERSECTED != intersects[ 0 ].object ) {
if (controls.AutoRotate) {
controls.autoRotate = false;
} }
}
}
For some reason, this function doesn't seem to be working and there are no errors showing up in the console. Any ideas on what might be causing this issue or how to solve it? It could be due to embedding DOM elements within three.js and using CSS renderer.