private void lightToSpatial(Light light) {
        TempVars vars = TempVars.get();
        Vector3f translation = vars.vect1;
        Vector3f direction = vars.vect2;
        Quaternion rotation = vars.quat1;
        boolean rotateSpatial = false, translateSpatial = false;

        if (light instanceof PointLight) {
            PointLight pLight = (PointLight) light;
            translation.set(pLight.getPosition());
            translateSpatial = true;
        } else if (light instanceof DirectionalLight) {
            DirectionalLight dLight = (DirectionalLight) light;
            direction.set(dLight.getDirection()).negateLocal();
            rotateSpatial = true;
        } else if (light instanceof SpotLight) {
            SpotLight sLight = (SpotLight) light;
            translation.set(sLight.getPosition());
            direction.set(sLight.getDirection()).negateLocal();
            translateSpatial = rotateSpatial = true;
        }
        if (spatial.getParent() != null) {
            spatial.getParent().getLocalToWorldMatrix(vars.tempMat4).invertLocal();
            vars.tempMat4.rotateVect(translation);
            vars.tempMat4.translateVect(translation);
            vars.tempMat4.rotateVect(direction);
        }

        if (rotateSpatial) {
            rotation.lookAt(direction, Vector3f.UNIT_Y).normalizeLocal();
            spatial.setLocalRotation(rotation);
        }
        if (translateSpatial) {
            spatial.setLocalTranslation(translation);
        }
        vars.release();
    }
Sets the spatial to adopt the light's world transformations.

@author Markil 3
jme3-core/src/main/java/com/jme3/scene/control/LightControl.java