In three-fiber, I have a spotlight, but it is "pointing" at {[0,0,0]}. I tried adjusting the target and the lookAt properties to {[0,0,0]}
<spotLight position={[0, 20, -20]} intensity={1.5} color="#fff" penumbra={0.5} castShadow={false} /> TypeError: Cannot read properties of undefined (reading 'elements')
As soon as I take away the target, it works, but its still pointing at [0,0,0].
1 Answer
The target of SpotLight must be an object added to the scene.
React-three-fiber implementation:
const spotlight = useMemo(() => new SpotLight('#fff'), []); <group> <primitive object={spotlight} position={[0, 20, -20]} intensity={1.5} penumbra={0.5} /> <primitive object={spotlight.target} position={[0, 0, 0]} /> </group>