add particles collision detection

This commit is contained in:
MihailRis
2024-11-03 01:59:41 +03:00
parent 1974298c82
commit b944f257f7
7 changed files with 58 additions and 22 deletions
+10 -1
View File
@@ -26,6 +26,11 @@ struct Particle {
class Texture;
struct ParticleBehaviour {
bool collision = true;
glm::vec3 gravity {0.0f, -16.0f, 0.0f};
};
class Emitter {
/// @brief Static position or entity
std::variant<glm::vec3, entityid_t> origin;
@@ -42,8 +47,10 @@ class Emitter {
/// to spawn on update. May be innacurate.
float timer = 0.0f;
/// @brief Random velocity magnitude applying to spawned particles
glm::vec3 explosion {1.0f};
glm::vec3 explosion {8.0f};
public:
ParticleBehaviour behaviour;
Emitter(
std::variant<glm::vec3, entityid_t> origin,
Particle prototype,
@@ -52,6 +59,8 @@ public:
int count
);
explicit Emitter(const Emitter&) = delete;
/// @return Emitter particles texture
const Texture* getTexture() const;