fix(physics): joints were being created on load, leading to long load times
(cherry picked from commit 2a60994013
)
This commit is contained in:
parent
99f4da8b2f
commit
259c14294c
2 changed files with 6 additions and 4 deletions
|
@ -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<Instance> obj = *it;
|
||||
if (!obj->IsA<BasePart>()) continue;
|
||||
std::shared_ptr<BasePart> part = obj->CastTo<BasePart>().expect();
|
||||
if (!it->IsA<BasePart>()) continue;
|
||||
std::shared_ptr<BasePart> part = it->CastTo<BasePart>().expect();
|
||||
part->MakeJoints();
|
||||
}
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ class DEF_INST_SERVICE_(explorer_icon="workspace") Workspace : public Service {
|
|||
void updatePartPhysics(std::shared_ptr<BasePart> part);
|
||||
protected:
|
||||
void InitService() override;
|
||||
void OnRun() override;
|
||||
bool initialized = false;
|
||||
|
||||
public:
|
||||
|
|
Loading…
Add table
Reference in a new issue