, chunk(0, 0, 0)
, angular_velocity(1.0f, 0.0f, 0.0f, 0.0f)
, rotation(1.0f)
-, world_collision(false) {
+, world_collision(false)
+, remove(false) {
}
glm::mat4 Transform(const Chunk::Pos &chunk_offset) const noexcept;
Ray Aim(const Chunk::Pos &chunk_offset) const noexcept;
+ void Remove() noexcept { remove = true; }
+ bool CanRemove() const noexcept { return remove; }
+
void Update(int dt) noexcept;
void Draw() noexcept;
glm::mat4 rotation;
bool world_collision;
+ bool remove;
};
Resolve(entity, col);
}
}
+ for (auto iter = entities.begin(), end = entities.end(); iter != end;) {
+ if (iter->CanRemove()) {
+ iter = entities.erase(iter);
+ } else {
+ ++iter;
+ }
+ }
chunks.Rebase(player->ChunkCoords());
chunks.Update(dt);
}