class_name PoliceCar extends CharacterBody3D @export var dot_curve: Curve func _physics_process(delta: float) -> void: %NavAgent.target_position = Player.instance.global_position var dir := global_position.direction_to(%NavAgent.get_next_path_position()) dir.y = 0 var dot_power := dot_curve.sample(dir.dot(velocity.normalized())) velocity += dir * 8. * delta * dot_power velocity = velocity.limit_length(8.) move_and_slide() rotation.y = Vector2(velocity.x, -velocity.z).angle() func hit(_proj: PlayerProjectile): queue_free() func _on_hurtbox_body_entered(body: Node3D) -> void: if body is Player: body.damage(self)