- BubbleTrail.gd: GPUParticles3D, auto-configured in _ready, set_intensity() API - BlockBreakParticles.gd: one_shot burst, emit_burst(pos, color) API - DolphinController.gd: bubble_trail onready + speed_factor hook in _update_movement - Dolphin.tscn: BubbleEmitterPoint (0,0,1.2) > BubbleTrail child added Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
863 B
GDScript
32 lines
863 B
GDScript
extends MeshInstance3D
|
|
|
|
var godrays_material: ShaderMaterial
|
|
|
|
func _ready() -> void:
|
|
var quad := QuadMesh.new()
|
|
quad.size = Vector2(20.0, 40.0)
|
|
mesh = quad
|
|
|
|
godrays_material = ShaderMaterial.new()
|
|
var shader := load("res://shaders/godrays.gdshader")
|
|
if shader:
|
|
godrays_material.shader = shader
|
|
|
|
var mat_override := godrays_material
|
|
material_override = mat_override
|
|
|
|
# Position in front of camera, slightly above center
|
|
position = Vector3(0.0, 5.0, -10.0)
|
|
|
|
func _process(_delta: float) -> void:
|
|
if not godrays_material:
|
|
return
|
|
|
|
# Get player/camera world Y to drive fade_bottom
|
|
var cam := get_viewport().get_camera_3d()
|
|
if cam:
|
|
var world_y := cam.global_position.y
|
|
# Deeper = fade bottom rises, reducing godray reach
|
|
var dynamic_fade := clamp(world_y - 20.0, -100.0, 0.0)
|
|
godrays_material.set_shader_parameter("fade_bottom", dynamic_fade)
|