The three.js SpotLighthas a 'target' property that sets where the SpotLightis pointing to:
.target
The Spotlight points from its position to target.position. The default position of the target is (0, 0, 0).
Note: For the target's position to be changed to anything other than the default, it must be added to the scene using
scene.add( light.target ); This is so that the target's matrixWorld gets automatically updated each frame.
It is also possible to set the target to be another object in the scene (anything with a position property), like so:
var targetObject = new THREE.Object3D();
scene.add(targetObject);
light.target = targetObject; The spotlight will now track the target object.
Actual behavior
The three.js 'target' property is not connected in React VR's SpotLight.js
Reproduction
If you translate the spotlight, it always points at 0,0,0
This leads to some very weird effects if you are expecting that you are moving the spotlight. I assumed you would set the spotlight position (using translate) and rotation.
Boy was I confused.
I checked three.js and found the target position (a 3D object) is needed.
Solution
We either need to expose the three.js target, or establish some way to indicate the direction the spotlight should shine.
I tried wrapping a around the spotlight, but it didn't seem to have any noticeable effect. Still testing ...
Description
Bug, or Documentation issue
Expected behavior
The three.js
SpotLight
has a 'target' property that sets where theSpotLight
is pointing to:Actual behavior
The three.js 'target' property is not connected in React VR's SpotLight.js
Reproduction
If you translate the spotlight, it always points at 0,0,0
This leads to some very weird effects if you are expecting that you are moving the spotlight. I assumed you would set the spotlight position (using translate) and rotation.
Boy was I confused.
I checked three.js and found the target position (a 3D object) is needed.
Solution
We either need to expose the three.js target, or establish some way to indicate the direction the spotlight should shine.
I tried wrapping a around the spotlight, but it didn't seem to have any noticeable effect. Still testing ...
Additional Information
-- react-vr@2.0.0
-- react-vr-web@2.0.0