Three.js: Cant set spotlight target correctly.

Created on 19 Mar 2018  路  2Comments  路  Source: mrdoob/three.js

Hi im trying to set up the car lights, but when i try to set the spotlight to the floor in front of the car it always target the point (0,0,0) nothing seems to modify that.
I've tried:

  • spotlight.target.position.set(x,y,z);
    -spotlight.target.updateMatrix();

I would aprecciate if you have any solution to do this quickly.
Thanks in advice.

Help (please use the forum)

Most helpful comment

Use scene.add(light.target) then scene.add(light). (scene.add(light.target, light) is also fine).

If you do this the other way around, the spotlight will target the default of (0,0,0).

All 2 comments

Use scene.add(light.target) then scene.add(light). (scene.add(light.target, light) is also fine).

If you do this the other way around, the spotlight will target the default of (0,0,0).

Was this page helpful?
0 / 5 - 0 ratings