17 lines
549 B
GDScript
17 lines
549 B
GDScript
extends Node3D
|
|
|
|
@export var heartbeat_max_distance: float = 25.0
|
|
@export_exp_easing("attenuation") var falloff: float = 3.5
|
|
|
|
@onready var beat_vibration: VibrationComponent = $BeatVibration
|
|
|
|
|
|
func _physics_process(_delta: float) -> void:
|
|
var player: PlayerCharacter = GameGlobals.get_player()
|
|
|
|
if is_instance_valid(player):
|
|
var distance: float = Utils.node_distance(self, player)
|
|
var strength: float = remap(distance, 0.0, heartbeat_max_distance, 1.0, 0.0)
|
|
strength = ease(strength, falloff)
|
|
beat_vibration.magnitude_multiplier = strength
|