Threejs BufferGeomatry光线投射没有击中

时间:2015-10-12 19:54:31

标签: node.js three.js raycasting

我正在创建一个细分的平面缓冲几何,以提高平面几何的性能,但是我的光线投射没有达到PlaneBufferGeometry。

我在控制台中收到此错误,我认为这可能是个问题:

THREE.BufferGeometry.computeBoundingSphere(): 
Computed radius is NaN. The "position" attribute is likely to have NaN values.

我创建缓冲几何的代码是:

var geometry = new THREE.PlaneBufferGeometry(maxs['ROW'], maxs['COL'], maxs['ROW'] / 4, maxs['COL'] / 4);

var floor = new THREE.Mesh(geometry, floorMaterial);

floor.rotation.x = -(Math.PI / 2);
floor.position.y = y;

我正在使用npm包中最新版本的ThreeJS。

你能告诉我我做错了什么吗?由于ThreeJS被缩小,我无法真正查看代码以找出它被抛出的原因。

1 个答案:

答案 0 :(得分:2)

确保传递给THREE.PlaneBufferGeometry的最后2个值是整数... parseInt( maxs['ROW'] / 4 ), parseInt( maxs['COL'] / 4 )