我已经设置了一个简单的场景,我将相机放在球体几何体内
var mat = new THREE.MeshBasicMaterial({map: THREE.ImageUtils.loadTexture('0.jpg') , overdraw:true, color: 0xffffff, wireframe: false });
var sphereGeo = new THREE.SphereGeometry(1000,50,50);
var sphere = new THREE.Mesh(sphereGeo,mat);
sphere.scale.x = -1;
sphere.doubleSided = false;
scene.add(sphere);
Run Code Online (Sandbox Code Playgroud)
我设置了一个功能,我可以在那个球体内部环顾四周,我的观点是能够在鼠标上投射光线,击中球体并获得发生击中的坐标.我正在投射一条光线但是相交仍然是空的.
var vector = new THREE.Vector3();
vector.set( ( event.clientX / window.innerWidth ) * 2 - 1, - ( event.clientY / window.innerHeight ) * 2 + 1, 0.5 );
vector.unproject( camera );
raycaster.ray.set( camera.position, vector.sub( camera.position ).normalize());
var intersects = raycaster.intersectObjects(scene.children, true);
Run Code Online (Sandbox Code Playgroud)
一切都适用于测试立方体也放在我的球体内.我的问题是,你是从内部击中物体还是不击中物体是否重要?因为这是我脑海中唯一的解释.
提前致谢.