How to make ShadowCamera visible in three.js r73?

亡梦爱人 提交于 2019-12-23 07:55:39

问题


Light.shadowCameraVisible = true;

gives a warning

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

on adding

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

gives an error

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

回答1:


The CameraHelper constructor takes a Camera object:

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

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

Three.js r107

Example: http://jsfiddle.net/kvnc1g4y/



来源:https://stackoverflow.com/questions/35171528/how-to-make-shadowcamera-visible-in-three-js-r73

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!