extends MeshInstance3D
@export var shake_amount: float = 5.0
@export var shake_speed: float = 5.4
var original_position: Vector3
func _ready():
original_position = position
func _process(delta):
var random_offset = Vector3(
randf_range(-shake_amount, shake_amount),
randf_range(-shake_amount, shake_amount),
randf_range(-shake_amount, shake_amount) # Añadido componente Z
)
position = original_position + random_offset
-------------------------------------------------------------------------------------------------------------------------
----------------------------------------------- este de debajo bombea--------------------------------------------
extends MeshInstance3D
@export var pulse_amount: float = 0.5 # Cantidad de expansión/contracción
@export var pulse_speed: float = 2.0 # Velocidad del latido
var original_scale: Vector3
var time: float = 0.0
func _ready():
original_scale = scale
func _process(delta):
time += delta * pulse_speed
var pulse = sin(time) * pulse_amount
scale = original_scale + Vector3(pulse, pulse, pulse) # Expande/contrae uniformemente
# O, si quieres que el latido sea solo en un eje (por ejemplo, el Y):
# scale = original_scale + Vector3(0, pulse, 0)