Merge pull request #92 from Vulpovile/feature/physics_sleep
Physics improvement and optimization
This commit is contained in:
@@ -81,7 +81,7 @@
|
||||
SuppressStartupBanner="true"
|
||||
ProgramDatabaseFile=".\Release/Blocks3D.pdb"
|
||||
SubSystem="2"
|
||||
StackReserveSize="8388608"
|
||||
StackReserveSize="16777216"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
@@ -180,7 +180,7 @@
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/Blocks3D.pdb"
|
||||
SubSystem="1"
|
||||
StackReserveSize="8388608"
|
||||
StackReserveSize="16777216"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
|
||||
@@ -346,9 +346,9 @@ void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
||||
p->setParent(NULL);
|
||||
delete p;
|
||||
}
|
||||
for(int i = 0; i < 10; i++)
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
_dataModel->getEngine()->step(0.05F);
|
||||
_dataModel->getEngine()->step(0.03F);
|
||||
}
|
||||
onLogic();
|
||||
|
||||
|
||||
@@ -259,7 +259,6 @@ void PartInstance::setCFrameNoSync(CoordinateFrame coordinateFrame)
|
||||
{
|
||||
cFrame = coordinateFrame;
|
||||
position = coordinateFrame.translation;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
bool PartInstance::collides(PartInstance * part)
|
||||
|
||||
@@ -15,7 +15,7 @@ XplicitNgine::XplicitNgine()
|
||||
physSpace = dHashSpaceCreate(0);
|
||||
contactgroup = dJointGroupCreate(0);
|
||||
|
||||
dWorldSetGravity(physWorld, 0, -0.5, 0);
|
||||
dWorldSetGravity(physWorld, 0, -9.8, 0);
|
||||
dWorldSetAutoDisableFlag(physWorld, 1);
|
||||
dWorldSetAutoDisableLinearThreshold(physWorld, 0.05F);
|
||||
dWorldSetAutoDisableAngularThreshold(physWorld, 0.05F);
|
||||
@@ -141,7 +141,7 @@ void XplicitNgine::createBody(PartInstance* partInstance)
|
||||
}
|
||||
|
||||
dMass mass;
|
||||
mass.setBox(partSize.x, partSize.y, partSize.z, 0.7F);
|
||||
mass.setBox(sqrt(partSize.x*2), sqrt(partSize.y*2), sqrt(partSize.z*2), 0.7F);
|
||||
dBodySetMass(partInstance->physBody, &mass);
|
||||
|
||||
// Debug output
|
||||
@@ -198,8 +198,9 @@ void XplicitNgine::step(float stepSize)
|
||||
{
|
||||
dJointGroupEmpty(contactgroup);
|
||||
dSpaceCollide (physSpace,0,&collisionCallback);
|
||||
//dWorldQuickStep(physWorld, stepSize);
|
||||
dWorldStepFast1(physWorld, stepSize, 20);
|
||||
dWorldQuickStep(physWorld, stepSize);
|
||||
//dWorldStepFast1(physWorld, stepSize*2, 100);
|
||||
//dWorldStep(physWorld, stepSize);
|
||||
}
|
||||
|
||||
void XplicitNgine::updateBody(PartInstance *partInstance, CoordinateFrame * cFrame)
|
||||
|
||||
Reference in New Issue
Block a user