Compare commits

...
Sign in to create a new pull request.

1 commit

2 changed files with 6 additions and 4 deletions

View file

@ -78,12 +78,13 @@ void Workspace::InitService() {
// physicsWorld->setSleepAngularVelocity(5); // physicsWorld->setSleepAngularVelocity(5);
physicsWorld->setEventListener(&physicsEventListener); physicsWorld->setEventListener(&physicsEventListener);
}
// 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<Part>()) continue;
if (!obj->IsA<Part>()) continue; std::shared_ptr<Part> part = it->CastTo<Part>().expect();
std::shared_ptr<Part> part = obj->CastTo<Part>().expect();
part->MakeJoints(); part->MakeJoints();
} }

View file

@ -75,6 +75,7 @@ class DEF_INST_SERVICE_(explorer_icon="workspace") Workspace : public Service {
void updatePartPhysics(std::shared_ptr<Part> part); void updatePartPhysics(std::shared_ptr<Part> part);
protected: protected:
void InitService() override; void InitService() override;
void OnRun() override;
bool initialized = false; bool initialized = false;
public: public: