-
Notifications
You must be signed in to change notification settings - Fork 985
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
OnClick events and the raycaster will give the wrong scaling of the model depending on the size of the screen resulting in missing the target when it should hit or hitting the target when it should miss.
If the current behavior is a bug, please provide the steps to reproduce.
add a mouse down event in the basic example then click next the torus knot or just above/below it
function mousedown( event ) {
var raycaster = new THREE.Raycaster();
var mouse = new THREE.Vector2();
mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1
mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1
event.stopPropagation();
raycaster.setFromCamera( mouse, camera );
var intersects =raycaster.intersectObjects([mesh],true);
console.log(intersects);
if (intersects.length>0) {
alert("clicked");
}
}
window.addEventListener( 'mousedown', mousedown, false );Please mention other relevant information such as the browser version, Operating System and Device Name
Chrome on PC and Phone
What is the expected behavior?
Accurate mousedown events causing the correct
If this is a feature request, what is motivation or use case for changing the behavior?
Anulo2 and shubham1172
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working