mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 12:01:50 +00:00
add particles collision detection
This commit is contained in:
parent
1974298c82
commit
b944f257f7
7 changed files with 58 additions and 22 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue