peterqliu / threebox

A three.js plugin for Mapbox GL JS, with support for basic animation and advanced 3D rendering.
MIT License
522 stars 317 forks source link

How can I add a spotlight? #63

Open huohuli008 opened 5 years ago

huohuli008 commented 5 years ago

I add a SpotLight with SpotLightHelper to three box use tb.Object3D({obj:spotLight}),and setCoords(coords),but the SpotLightHelper `s coordinates looks like at the (0,0) even I set any coords, here is the code can be use to test.

`<!doctype html>

Raycaster
`
MagicBYang commented 4 years ago

@huohuli008 Same problem I get part of the answer to the SpotLightHelper question. 1.I find SpotLightHelper is wrong display but the actually the SpotLight run properly under threebox. 2.The SpotLightHelper appers to be wrong on calculating the matrix inside it`s hard to be corrected from outside threebox. 3.What I recommend is that you should build a alternative helper thing just like the pic below

image

It`s not work as good as SpotLightHelper but it helps me to deal with the SpotLight problem. Hope to give you some help.