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->setEventListener(&physicsEventListener);
}
// 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<Part>()) continue;
std::shared_ptr<Part> part = obj->CastTo<Part>().expect();
if (!it->IsA<Part>()) continue;
std::shared_ptr<Part> part = it->CastTo<Part>().expect();
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);
protected:
void InitService() override;
void OnRun() override;
bool initialized = false;
public: