@tool extends SpotLight3D class_name VolumetricLight3D var node:MeshInstance3D=MeshInstance3D.new() var mesh:CylinderMesh=CylinderMesh.new() @export var material:Material=Material.new() func _ready() -> void: mesh.top_radius=0 mesh.material=material node.mesh=mesh node.rotation_degrees.x=90 self.add_child(node) mesh.height=self.spot_range node.position.z=-(self.spot_range/2) var angle_rad=deg_to_rad(self.spot_angle) mesh.bottom_radius=self.spot_range * tan(angle_rad) func _process(delta: float) -> void: if Engine.is_editor_hint(): mesh.height=self.spot_range node.position.z=-(self.spot_range/2) var angle_rad=deg_to_rad(self.spot_angle) mesh.bottom_radius=self.spot_range * tan(angle_rad) else: self.process_mode=Node.PROCESS_MODE_DISABLED