mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add particles collision detection
This commit is contained in:
parent
1974298c82
commit
b944f257f7
7 changed files with 58 additions and 22 deletions
|
|
@ -15,7 +15,8 @@ Emitter::Emitter(
|
|||
prototype(std::move(prototype)),
|
||||
texture(texture),
|
||||
spawnInterval(spawnInterval),
|
||||
count(count) {
|
||||
count(count),
|
||||
behaviour() {
|
||||
this->prototype.emitter = this;
|
||||
}
|
||||
|
||||
|
|
@ -37,6 +38,7 @@ void Emitter::update(float delta, std::vector<Particle>& particles) {
|
|||
while (count && timer > spawnInterval) {
|
||||
// spawn particle
|
||||
Particle particle = prototype;
|
||||
particle.emitter = this;
|
||||
particle.position = position;
|
||||
particle.velocity += glm::ballRand(1.0f) * explosion;
|
||||
particles.push_back(std::move(particle));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue