#pragma once #include "objects/base/instance.h" #include "../annotation.h" #include #include #include "datatypes/cframe.h" //this is necessary ebcause we use std::weak_ptr without including it in this file #ifdef __AUTOGEN_EXTRA_INCLUDES__ #include "objects/part/part.h" #endif class BasePart; class Workspace; class DEF_INST_ABSTRACT JointInstance : public Instance { AUTOGEN_PREAMBLE std::weak_ptr oldPart0; std::weak_ptr oldPart1; protected: // The workspace the joint was created in, if it exists std::weak_ptr jointWorkspace; void OnAncestryChanged(std::optional>, std::optional>) override; std::optional> workspaceOfPart(std::shared_ptr); void onUpdated(std::string property); virtual void buildJoint() = 0; virtual void breakJoint() = 0; public: DEF_PROP_(on_update=onUpdated) std::weak_ptr part0; DEF_PROP_(on_update=onUpdated) std::weak_ptr part1; DEF_PROP_(on_update=onUpdated) CFrame c0; DEF_PROP_(on_update=onUpdated) CFrame c1; JointInstance(const InstanceType*); ~JointInstance(); };