Physixxxxx

This commit is contained in:
andreja6
2018-10-25 12:58:56 -07:00
parent 0566dd0217
commit 5dd6ae7d9c
3 changed files with 20 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ bool Globals::useMousePoint = false;
const std::string Globals::PlaceholderName = "Dynamica";
std::vector<Instance*> g_selectedInstances = std::vector<Instance*>();
bool running = false;
G3D::TextureRef Globals::surface;
POINT Globals::mousepoint;
Globals::Globals(void){}

View File

@@ -20,4 +20,5 @@ public:
static const std::string PlaceholderName;
};
extern std::vector<Instance*> g_selectedInstances;
extern std::vector<Instance*> g_selectedInstances;
extern bool running;

View File

@@ -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<Instance*> Demo::getSelection()
return g_selectedInstances;
}
void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
if(!running)
{
std::vector <Instance* > objects = dataModel->getWorkspace()->getAllChildren();
for(size_t i = 0; i < objects.size(); i++)
{
if(PartInstance* moveTo = dynamic_cast<PartInstance*>(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");