Following method of adding light helper works ok:

var light = new THREE.SpotLight( 0xFFFFFF );
var helper = new THREE.SpotLightHelper( light );

but following will cause helper to be off position:

var wrapper = new THREE.Object3D();
var light = new THREE.SpotLight( 0xFFFFFF );
var helper = new THREE.SpotLightHelper( light );

It seems like helper position is taken from absolute light position to scene, but is then applied from it's wrapper, that means it is actually applied twice a thus doesn't match actual position of the light. In this example, helper would appear on (200,200,200). Same applies for PointLight and probably other light types.

Is it possible to put helpers into wrapper together with light and avoid position problem?

demonstration: http://jsfiddle.net/wfpxdw37/24/

  • \$\begingroup\$ Which version of Three.JS? Also please create a jsfiddle recreating the issue. \$\endgroup\$ Dec 1, 2014 at 19:23
  • \$\begingroup\$ @ClassicThunder I was referring to current revision 69, but problem is apparently present in r54, which is the only one available in jsfiddle. jsfiddle.net/wfpxdw37/24 \$\endgroup\$
    – lot
    Dec 1, 2014 at 20:16
  • \$\begingroup\$ @lot you can use r69 on codepen, and in r69 it appears that you can set the helper matrix to the light matrix (whereas in r54 it didn't seem to take). \$\endgroup\$ Dec 2, 2014 at 17:07
  • \$\begingroup\$ @XGundam05 According to creators of THREE.JS it is not possible at this moment and light helpers must be added to scene directly. How would your solution work? I am not skilled much with matrices... \$\endgroup\$
    – lot
    Dec 2, 2014 at 18:04
  • \$\begingroup\$ Something akin to this. That sets the helper matrix to point to the light matrix, which has values relative to the wrapper space. I'm not certain how the helper originally calculates it's matrix, nor can I guarantee it won't break in future iterations, but for now it appears to work. \$\endgroup\$ Dec 2, 2014 at 18:39


You must log in to answer this question.

Browse other questions tagged .