diff --git a/core/src/objects/service/workspace.cpp b/core/src/objects/service/workspace.cpp index 5a8584f..1f56c1f 100644 --- a/core/src/objects/service/workspace.cpp +++ b/core/src/objects/service/workspace.cpp @@ -85,12 +85,13 @@ void Workspace::InitService() { // Create meshes WedgePart::createWedgeShape(physicsCommon); +} - // Sync all parts +void Workspace::OnRun() { + // Make joints for (auto it = this->GetDescendantsStart(); it != this->GetDescendantsEnd(); it++) { - std::shared_ptr obj = *it; - if (!obj->IsA()) continue; - std::shared_ptr part = obj->CastTo().expect(); + if (!it->IsA()) continue; + std::shared_ptr part = it->CastTo().expect(); part->MakeJoints(); } diff --git a/core/src/objects/service/workspace.h b/core/src/objects/service/workspace.h index ce4975a..3da9aa8 100644 --- a/core/src/objects/service/workspace.h +++ b/core/src/objects/service/workspace.h @@ -89,6 +89,7 @@ class DEF_INST_SERVICE_(explorer_icon="workspace") Workspace : public Service { void updatePartPhysics(std::shared_ptr part); protected: void InitService() override; + void OnRun() override; bool initialized = false; public: