hi I Have a car model in my scene and i want to use spot light for its headlight so that it cast light in front of the car on the ground but my problem is that i can’t change position or rotation of the spotLight.I’ve tested position and target position but i couldn’t figure out its logic.
here’s my scene:
i want to move lights position to car’s front.
sorry for my poor language
here’s my code:
spotLight = new THREE.SpotLight( 0xff0000, 10 );
// scene.add( spotLight.target );
spotLight.position.set(0,0,-1);
spotLight.angle = Math.PI / 4;
spotLight.penumbra = 0.05;
spotLight.decay = 2;
spotLight.distance = 1000;
spotLight.intensity = 2;
spotLight.castShadow = true;
spotLight.shadow.mapSize.width = 1024;
spotLight.shadow.mapSize.height = 1024;
spotLight.shadow.camera.near = 10;
spotLight.shadow.camera.far = 1000;
scene.add( spotLight );
spotLight.target.position.set(0,0,200);
spotLight.target.updateMatrixWorld();