generated from krampus/template-godot4
17 lines
510 B
GDScript3
17 lines
510 B
GDScript3
|
class_name BallParticleEffects extends Node3D
|
||
|
## Controller for ball particle effects.
|
||
|
|
||
|
@onready var sand_particles: GPUParticles3D = %SandParticles
|
||
|
|
||
|
@onready var ball: GameBall = $".."
|
||
|
|
||
|
|
||
|
func play_effect(terrain: Terrain.Type) -> void:
|
||
|
global_rotation = Vector3.ZERO
|
||
|
match terrain:
|
||
|
Terrain.Type.SAND:
|
||
|
# Adjust sand particle direction
|
||
|
var material: ParticleProcessMaterial = sand_particles.process_material
|
||
|
material.direction = -ball.linear_velocity.normalized()
|
||
|
sand_particles.emitting = true
|