File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,12 +78,13 @@ void Workspace::InitService() {
7878 // physicsWorld->setSleepAngularVelocity(5);
7979
8080 physicsWorld->setEventListener (&physicsEventListener);
81+ }
8182
82- // Sync all parts
83+ void Workspace::OnRun () {
84+ // Make joints
8385 for (auto it = this ->GetDescendantsStart (); it != this ->GetDescendantsEnd (); it++) {
84- std::shared_ptr<Instance> obj = *it;
85- if (!obj->IsA <Part>()) continue ;
86- std::shared_ptr<Part> part = obj->CastTo <Part>().expect ();
86+ if (!it->IsA <Part>()) continue ;
87+ std::shared_ptr<Part> part = it->CastTo <Part>().expect ();
8788 part->MakeJoints ();
8889 }
8990
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ class DEF_INST_SERVICE_(explorer_icon="workspace") Workspace : public Service {
7575 void updatePartPhysics (std::shared_ptr<Part> part);
7676protected:
7777 void InitService () override ;
78+ void OnRun () override ;
7879 bool initialized = false ;
7980
8081public:
You can’t perform that action at this time.
0 commit comments