Skip to content

Instantly share code, notes, and snippets.

@Niriel
Created September 16, 2022 15:22
Show Gist options
  • Save Niriel/57c2aba196f53b66e281e477d1c97a56 to your computer and use it in GitHub Desktop.
Save Niriel/57c2aba196f53b66e281e477d1c97a56 to your computer and use it in GitHub Desktop.
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