#ifndef BEAM_HPP
#define BEAM_HPP

#include <godot_cpp/classes/area3d.hpp>
#include <godot_cpp/classes/capsule_mesh.hpp>
#include <godot_cpp/classes/capsule_shape3d.hpp>
#include <godot_cpp/classes/collision_shape3d.hpp>
#include <godot_cpp/classes/mesh.hpp>
#include <godot_cpp/classes/mesh_instance3d.hpp>
#include <godot_cpp/classes/shape3d.hpp>

namespace godot {
class Beam : public Area3D {
    GDCLASS(Beam, Area3D);
    static void _bind_methods();
public:
    virtual void _enter_tree() override;
    virtual void _process(double delta_time) override;
    void body_entered(Node3D *node);
    void set_from_to(Vector3 from, Vector3 to);
    void set_end_time(float time_from_now);
private:
    MeshInstance3D *mesh_instance{nullptr};
    Ref<CapsuleMesh> mesh{};
    CollisionShape3D *collision_shape{nullptr};
    Ref<CapsuleShape3D> shape{};
    float end_time{0.f};
};
}

#endif // !BEAM_HPP
