feat(physics): last part of model that falls off world destroys model too
This commit is contained in:
parent
964c733f53
commit
1af34a21fa
1 changed files with 5 additions and 0 deletions
|
@ -151,7 +151,12 @@ void Workspace::PhysicsStep(float deltaTime) {
|
|||
|
||||
// Destroy fallen parts
|
||||
if (part->cframe.Position().Y() < this->fallenPartsDestroyHeight) {
|
||||
auto parent = part->GetParent();
|
||||
part->Destroy();
|
||||
|
||||
// If the parent of the part is a Model, destroy it too
|
||||
if (parent.has_value() && parent.value()->IsA("Model"))
|
||||
parent.value()->Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue