Created
September 16, 2022 15:22
-
-
Save Niriel/57c2aba196f53b66e281e477d1c97a56 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tool | |
extends Spatial | |
export var debug_run := false setget set_debug_run | |
onready var sun_light: DirectionalLight = $SunLight | |
onready var world_env: Environment = $WorldEnvironment.environment | |
func _ready(): | |
env_to_light() | |
func _physics_process(_delta: float) -> void: | |
env_to_light() | |
func env_to_light() -> void: | |
var sky := world_env.background_sky as ProceduralSky | |
sun_light.rotation_degrees = Vector3(180.0 + sky.sun_latitude, -sky.sun_longitude, 0.0) | |
func set_debug_run(_new_value: bool) -> void: | |
env_to_light() | |
debug_run = false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment