Files
godot-demo-projects/xr/openxr_origin_centric_movement/objects/black_out.gd
A Thousand Ships 0343cedd48 General proofreading (#1262)
* General proofreading for grammar and spelling
* General formatting
* Addition of appropriate literals where appropriate, i.e. `&"foo"` for `StringName` cases and `^"foo/bar"` for `NodePath` cases
2025-10-11 01:39:59 -07:00

24 lines
458 B
GDScript

@tool
extends Node3D
@export_range(0, 1, 0.1) var fade := 0.0:
set(value):
fade = value
if is_inside_tree():
_update_fade()
var material: ShaderMaterial
func _update_fade() -> void:
if fade == 0.0:
$MeshInstance3D.visible = false
else:
if material:
material.set_shader_parameter(&"albedo", Color(0.0, 0.0, 0.0, fade))
$MeshInstance3D.visible = true
func _ready() -> void:
material = $MeshInstance3D.material_override
_update_fade()