diff --git a/Globals.cpp b/Globals.cpp index 5d7ca78..4ccf40e 100644 --- a/Globals.cpp +++ b/Globals.cpp @@ -11,6 +11,7 @@ bool Globals::useMousePoint = false; const std::string Globals::PlaceholderName = "Dynamica"; std::vector g_selectedInstances = std::vector(); +bool running = false; G3D::TextureRef Globals::surface; POINT Globals::mousepoint; Globals::Globals(void){} diff --git a/Globals.h b/Globals.h index 8aed8fa..5e5d88e 100644 --- a/Globals.h +++ b/Globals.h @@ -20,4 +20,5 @@ public: static const std::string PlaceholderName; }; -extern std::vector g_selectedInstances; \ No newline at end of file +extern std::vector g_selectedInstances; +extern bool running; \ No newline at end of file diff --git a/main.cpp b/main.cpp index 7fa68c9..b416f48 100644 --- a/main.cpp +++ b/main.cpp @@ -72,7 +72,6 @@ static int cursorOvrid = 0; static int currentcursorid = 0; static G3D::TextureRef cursor = NULL; static G3D::TextureRef cursorOvr = NULL; -static bool running = true; static bool mouseMovedBeginMotion = false; static const int CURSOR = 0; static const int ARROWS = 1; @@ -852,8 +851,23 @@ std::vector Demo::getSelection() return g_selectedInstances; } void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) { - - + if(!running) + { + std::vector objects = dataModel->getWorkspace()->getAllChildren(); + for(size_t i = 0; i < objects.size(); i++) + { + if(PartInstance* moveTo = dynamic_cast(objects.at(i))) + { + moveTo->velocity.y -= (196.2F/30); + moveTo->setPosition(Vector3(moveTo->getPosition().x, moveTo->getPosition().y+(moveTo->velocity.y)/30, moveTo->getPosition().z)); + if(moveTo->getPosition().y < -128) + { + moveTo->setParent(NULL); + delete moveTo; + } + } + } + } Instance * obj6 = dataModel->getGuiRoot()->findFirstChild("Delete"); Instance * obj = dataModel->getGuiRoot()->findFirstChild("Duplicate");