我有几个THREE.PlaneGeometry,其人脸纹理在脸部周围有透明像素。
我正在使用THREE.Raycaster来检测鼠标指针下的对象,当我得到相交列表时 - 我需要知道点击是否在透明像素上,如果是这种情况 - 移动到下一个交叉对象。
这样的事情:
var onStageMouseDown = function( event ) {
event.preventDefault();
// stageEl - is the element that contain the renderer
var vector = new THREE.Vector3(
( event.offsetX / stageEl.offsetWidth ) * 2 - 1,
- ( event.offsetY / stageEl.offsetHeight ) * 2 + 1,
0.5 );
projector.unprojectVector( vector, camera );
var ray = new THREE.Raycaster( camera.position, vector.sub( camera.position ).normalize() );
// objects - is list of meshes
var intersects = ray.intersectObjects( objects );
for(var i=0; i<intersects.length; i++) {
// this is what I don't know how to calculate....
var PointIsTransparentPixelOnMeshTexture = ?;
if ( PointIsTransparentPixelOnMeshTexture ) continue;
alert( "You clicked on "+intersects[i].object.name );
return;
}
alert( "You clicked no one " );
}
任何想法?
感谢。