mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
fix: access to deleted Sensor
This commit is contained in:
parent
f8907f7db1
commit
50a388c539
3 changed files with 12 additions and 0 deletions
|
|
@ -347,6 +347,12 @@ void Entities::clean() {
|
|||
if (!registry.get<EntityId>(it->second).destroyFlag) {
|
||||
++it;
|
||||
} else {
|
||||
auto& rigidbody = registry.get<Rigidbody>(it->second);
|
||||
// todo: refactor
|
||||
auto physics = level->physics.get();
|
||||
for (auto& sensor : rigidbody.sensors) {
|
||||
physics->removeSensor(&sensor);
|
||||
}
|
||||
uids.erase(it->second);
|
||||
registry.destroy(it->second);
|
||||
it = entities.erase(it);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue