Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

563
Vistas
Three JS: Intersection with mouse click raycast on point cloud yields no results (empty array)

I am rendering a point cloud and trying to select a single point, but the method raycaster.intersectObjects(scene.children, true) is yielding an empty array. I also found a lot of different ways to calculate the pointer.x and pointer.y. None of them worked.

Here is my CodePen: https://codepen.io/joshua-holly-fraunhofer/pen/VwyGBVO

What is wrong here?

function onMouseUp(event) {
  event.preventDefault();
  const raycaster = new THREE.Raycaster();
  const pointer = new THREE.Vector2();
  pointer.x = (event.clientX / window.innerWidth) * 2 - 1;
  pointer.y = -(event.clientY / window.innerHeight) * 2 + 1;

  raycaster.setFromCamera(pointer, camera);

  const intersects = raycaster.intersectObjects(scene.children, true);
  console.log(intersects); // Is empty array
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Your code is working, but the camera is very far from the point cloud (1800 units), which makes the individual Points relatively tiny. With the default raycast threshold (1 unit, see Raycaster.params), the user has to click extremely (and perhaps impossibly) close to a Point in order for an intersection to register. In fact, some napkin math tells me that at 1080p, you have to click within 0.2px of the point, but clicks are only measured to a precision of 1px.

Since your points material uses 60-unit shapes to represent the points, increase the threshold to that size, and you'll start getting the results you expect. After the line that initializes raycaster, add this line:

raycaster.params.Points.threshold = 60;
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda