Ray碰撞因THREE.Sprite而失败

时间:2013-12-05 02:31:10

标签: three.js raycasting

我正在使用投影仪和raycaster来交叉Three.Sprite对象,但是,即使我触摸图像边界外,我也可以获得该对象。所以,我深入到了three.js文件中,并找到了一个来源:

var intersectObject = function ( object, raycaster, intersects ) {  
if ( object instanceof THREE.Sprite ) {  
   matrixPosition.getPositionFromMatrix( object.matrixWorld ); 
var distance = raycaster.ray.distanceToPoint( matrixPosition );
if ( distance > object.scale.x ) {
    return intersects;
} 
intersects.push( { 
    distance: distance, 
    point: object.position, 
    face: null, 
    object: object 
});

我无法理解if ( distance > object.scale.x ),我认为这是我遇到的问题。我是Threejs的新手。我去了吗?谢谢你的帮助!!

0 个答案:

没有答案