|
@@ -12,17 +12,18 @@ export default class MobileDirectionalLight extends RE.Component {
|
|
|
const directionalLight: THREE.DirectionalLight = this.object3d as THREE.DirectionalLight
|
|
|
this.initialOffset = this.object3d.position.clone()
|
|
|
this.initialOffset.sub(new THREE.Vector3(0, 0, 0))
|
|
|
- const offset: THREE.Vector3 = this.initialOffset.clone().add(this.target.position)
|
|
|
- directionalLight.position.set(offset.x, offset.y, offset.z)
|
|
|
- directionalLight.shadow.camera.position.set(offset.x, offset.y, offset.z)
|
|
|
+ this.updatePositions()
|
|
|
directionalLight.target = this.target
|
|
|
}
|
|
|
|
|
|
update() {
|
|
|
+ this.updatePositions()
|
|
|
+ }
|
|
|
+
|
|
|
+ updatePositions() {
|
|
|
const directionalLight: THREE.DirectionalLight = this.object3d as THREE.DirectionalLight
|
|
|
const offset: THREE.Vector3 = this.initialOffset.clone().add(this.target.position)
|
|
|
directionalLight.position.set(offset.x, offset.y, offset.z)
|
|
|
-
|
|
|
directionalLight.shadow.camera.position.set(offset.x, offset.y, offset.z)
|
|
|
}
|
|
|
}
|