Improved Physics
This commit is contained in:
@@ -12,7 +12,8 @@ public:
|
||||
dSpaceID physSpace;
|
||||
dJointGroupID contactgroup;
|
||||
|
||||
void createBody(PartInstance* partInstance, float stepSize);
|
||||
void step(float stepSize);
|
||||
void createBody(PartInstance* partInstance);
|
||||
void deleteBody(PartInstance* partInstance);
|
||||
void updateBody(PartInstance* partInstance, CoordinateFrame * cFrame);
|
||||
};
|
||||
@@ -329,7 +329,7 @@ void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
||||
toDelete.push_back(partInstance);
|
||||
}
|
||||
else
|
||||
_dataModel->getEngine()->createBody(partInstance, sdt*15/_dataModel->getWorkspace()->partObjects.size());
|
||||
_dataModel->getEngine()->createBody(partInstance);
|
||||
}
|
||||
while(toDelete.size() > 0)
|
||||
{
|
||||
@@ -338,6 +338,10 @@ void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
||||
p->setParent(NULL);
|
||||
delete p;
|
||||
}
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
_dataModel->getEngine()->step(sdt*2);
|
||||
}
|
||||
onLogic();
|
||||
|
||||
}
|
||||
|
||||
@@ -79,10 +79,10 @@ void XplicitNgine::deleteBody(PartInstance* partInstance)
|
||||
}
|
||||
}
|
||||
|
||||
void XplicitNgine::createBody(PartInstance* partInstance, float stepSize)
|
||||
void XplicitNgine::createBody(PartInstance* partInstance)
|
||||
{
|
||||
// calculate collisions
|
||||
dSpaceCollide (physSpace,0,&collisionCallback);
|
||||
//dSpaceCollide (physSpace,0,&collisionCallback);
|
||||
|
||||
if(partInstance->physBody == NULL)
|
||||
{
|
||||
@@ -161,6 +161,13 @@ void XplicitNgine::createBody(PartInstance* partInstance, float stepSize)
|
||||
}
|
||||
}
|
||||
//STEP SHOULD NOT BE HERE!
|
||||
//dWorldQuickStep(physWorld, stepSize);
|
||||
//dJointGroupEmpty(contactgroup);
|
||||
}
|
||||
|
||||
void XplicitNgine::step(float stepSize)
|
||||
{
|
||||
dSpaceCollide (physSpace,0,&collisionCallback);
|
||||
dWorldQuickStep(physWorld, stepSize);
|
||||
dJointGroupEmpty(contactgroup);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user