【发布时间】:2021-11-04 20:19:45
【问题描述】:
所以我习惯于这样设置助手:
useHelper(sLightRef, THREE.SpotLightHelper);
return <spotLight
castShadow
ref={sLightRef}
position={[0, 2, 2]}
args={["#fff", 0.4, 10, Math.PI * 0.3]}
></spotLight>
这将在 SpotLight 对象上创建一个助手。
我不明白的是如何在 SpotLight 的阴影相机上创建一个。 (spotlight.shadow.camera) 我们不能为它分配一个 ref(),因为它不在我的 return 语句中。它是在 SpotLight 组件内部创建的。
在普通的 Three.js 中,这很简单:
const helper = new THREE.CameraHelper(spotlight.shadow.camera);
scene.add(helper);
我将如何在 react-three-fiber 中执行此操作?我有什么明显的遗漏吗?谢谢。
【问题讨论】:
标签: three.js react-three-fiber