extends Node3D
class_name Body

const LERP_VELOCITY: float = 0.15

@export_category("Objects")
@export var _character: CharacterBody3D = null
@export var animation_player: AnimationPlayer = null
	
func animate(_velocity: Vector3) -> void:
	if not _character.is_on_floor():
		if _velocity.y < 0:
			animation_player.play("fall")
		else:
			animation_player.play("up")
		return

	if _velocity.length() > 0.1:  # Если есть движение
		if _character.is_running():
			animation_player.play("run")  # Спринт
		else:
			animation_player.play("walk")  # Обычная ходьба
		return
	
	animation_player.play("idle")  # Бездействие
	
@rpc("any_peer", "reliable")
func sync_player_rotation(rotation_y: float) -> void:
	rotation.y = rotation_y
