如何在three.js r73中显示ShadowCamera?

时间:2016-02-03 08:04:47

标签: javascript 3d three.js shadow

Light.shadowCameraVisible = true;

发出警告

THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow ) instead.

添加

Scene.add(new THREE.CameraHelper(Light.shadow ));

给出错误

Uncaught TypeError: this.camera.updateProjectionMatrix is not a function (three.js :35002)

1 个答案:

答案 0 :(得分:12)

CameraHelper构造函数采用Camera对象:

var light = new THREE.SpotLight( 0xFFAA55 );
light.castShadow = true;

var helper = new THREE.CameraHelper( light.shadow.camera );
scene.add( helper );

Three.js r73

示例:http://jsfiddle.net/f17Lz5ux/5131/