import * as THREE from 'three';

onmessage = (event) => {
    const { controlsTarget, sunPosition, offsetDistance } = event.data;

    const lightPosition = new THREE.Vector3()
        .copy(controlsTarget)
        .addScaledVector(new THREE.Vector3().copy(sunPosition).normalize(), offsetDistance);

    postMessage({ lightPosition, controlsTarget });
};