Closed BrunoFigueiraBarros closed 1 year ago
@hiukim could you show some example?
I think it should be the same as how you would normally use raycaster.
@hiukim I'm using normal raycast but it's not working
function onClick() {
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.children, true);
if (intersects.length > 0) {
intersects[0].object.material.color.set( 0xff0000 );
console.log('Intersection:', intersects[0]);
}
render();
}
I can't see any obvious error with your code at first sight. There might be bugs on other parts, I'm not sure. Or there might be bugs on three.js side or the loaded models.
I managed to solve it, thanks
Old
render();
New
renderer.render(scene, camera);
Is it possible to use raycaster with Three.js and Mind-ar?
Does anyone have an example using GLTF