Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

97
Views
raycaster do not generate a known intersection

I just created a simple environment with 2 spheres and making raycast between each other. From A to B I get intersection but not from B to A, why this can happen ?

here a fiddle

objs.forEach(obj => {
    const Object = new THREE.Mesh(new THREE.SphereGeometry(1, 32, 32), new THREE.MeshBasicMaterial({
        color: 0xff0000
    }));
    Object.position.set(obj.pos.x, obj.pos.y, obj.pos.z);
    scene.add(Object);

});

objs.forEach(originObj => { // origin 

    const oPos = new THREE.Vector3(originObj.pos.x, originObj.pos.y, originObj.pos.z);
        
   
    objs.forEach(destinyObj => { // destiny 
    

        if (originObj.id != destinyObj.id) { // only check with the others


            const dPos = new THREE.Vector3(destinyObj.pos.x, destinyObj.pos.y, destinyObj.pos.z);
            
            
            let dir = new THREE.Vector3();
            dir = dir.subVectors(dPos, oPos).normalize();
            
          
            const raycaster = new THREE.Raycaster();
            raycaster.set(oPos, dir);
            
            const intersects = raycaster.intersectObject(scene, true);

        }
    });
});

Thanks in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!