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
|
// Create meshes
|
||||||
WedgePart::createWedgeShape(physicsCommon);
|
WedgePart::createWedgeShape(physicsCommon);
|
||||||
|
}
|
||||||
|
|
||||||
// Sync all parts
|
void Workspace::OnRun() {
|
||||||
|
// Make joints
|
||||||
for (auto it = this->GetDescendantsStart(); it != this->GetDescendantsEnd(); it++) {
|
for (auto it = this->GetDescendantsStart(); it != this->GetDescendantsEnd(); it++) {
|
||||||
std::shared_ptr<Instance> obj = *it;
|
if (!it->IsA<BasePart>()) continue;
|
||||||
if (!obj->IsA<BasePart>()) continue;
|
std::shared_ptr<BasePart> part = it->CastTo<BasePart>().expect();
|
||||||
std::shared_ptr<BasePart> part = obj->CastTo<BasePart>().expect();
|
|
||||||
part->MakeJoints();
|
part->MakeJoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ class DEF_INST_SERVICE_(explorer_icon="workspace") Workspace : public Service {
|
||||||
void updatePartPhysics(std::shared_ptr<BasePart> part);
|
void updatePartPhysics(std::shared_ptr<BasePart> part);
|
||||||
protected:
|
protected:
|
||||||
void InitService() override;
|
void InitService() override;
|
||||||
|
void OnRun() override;
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Reference in a new issue