Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

576
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda