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

198
Visualizações
Three JS unable to raycast to mesh walls

I’m trying to raycast from the center of a character to detect distance to walls and prevent collisions. I’ve set both the material to DoubleSide as well as updated MatrixWorld but I’m still getting an empty intersect array.

My code is below:

mesh_parent_object.updateMatrixWorld();
mesh_parent_object.material[0].side = THREE.DoubleSide;

var raycaster                       = new THREE.Raycaster();

var vector_origin                   = new THREE.Vector3(character.position.x, 0, character.position.z);
var vector_target                   = new THREE.Vector3(-1.2741646766662598, character.position.y, 1.8035423755645752); 
var vector_direction                = vector_target.clone().sub(character.position).normalize();

raycaster.set(vector_origin, vector_direction);                     
var intersects                      = raycaster.intersectObject(mesh_parent_object, true);

I’ve included a screenshot showing that the raycast intersects the walls and even goes through.

enter image description here

Can someone please help me get the intersect values for meshes like this?

Thank You!

about 4 years ago · Juan Pablo Isaza
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