# Rally Rush: src/beam.hpp Source File

Loading...
Searching...
No Matches
beam.hpp
Go to the documentation of this file.
#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
godot::Beam
Area3D with a MeshInstance3D that resizes itself based on a from and to position and damages any obje...
Definition beam.hpp:14
godot::Beam::set_from_to
void set_from_to(Vector3 from, Vector3 to)
Transform self and shapes to stretch from -> to.
Definition beam.cpp:34
godot::Beam::end_time
float end_time
Definition beam.hpp:34
godot::Beam::_bind_methods
static void _bind_methods()
Required to be a valid godot class.
Definition beam.cpp:6
godot::Beam::shape
Ref< CapsuleShape3D > shape
Definition beam.hpp:33
godot::Beam::set_end_time
void set_end_time(float time_from_now)
Pass in a duration and set the destroy timer for this object.
Definition beam.cpp:47
godot::Beam::_enter_tree
virtual void _enter_tree() override
Get child collision shape and mesh instance. Assumes both have a Capsule primitive shape....
Definition beam.cpp:10
godot::Beam::_process
virtual void _process(double delta_time) override
Destroy self after end time passes.
Definition beam.cpp:24
godot::Beam::collision_shape
CollisionShape3D * collision_shape
Definition beam.hpp:32
godot::Beam::mesh
Ref< CapsuleMesh > mesh
Definition beam.hpp:31
godot::Beam::body_entered
void body_entered(Node3D *node)
Deal damage on whatever enters this node. Configure what to damage using collision mask.
Definition beam.cpp:30
godot::Beam::mesh_instance
MeshInstance3D * mesh_instance
Definition beam.hpp:30
godot::Beam::GDCLASS
GDCLASS(Beam, Area3D)
godot
Definition beacon_powerup.cpp:6