diff --git a/Blocks3D.vcproj b/Blocks3D.vcproj
index a6a890c..a114f7b 100644
--- a/Blocks3D.vcproj
+++ b/Blocks3D.vcproj
@@ -49,16 +49,12 @@
-
-
diff --git a/src/source/DataModelV2/PartInstance.cpp b/src/source/DataModelV2/PartInstance.cpp
index 1a73873..f74a54b 100644
--- a/src/source/DataModelV2/PartInstance.cpp
+++ b/src/source/DataModelV2/PartInstance.cpp
@@ -117,7 +117,10 @@ void PartInstance::setSurface(int face, Enum::SurfaceType::Value surface)
void PartInstance::setParent(Instance* prnt)
{
- g_dataModel->getEngine()->deleteBody(this);
+ if(this->physBody != NULL)
+ {
+ g_dataModel->getEngine()->deleteBody(this);
+ }
Instance * cparent = getParent();
while(cparent != NULL)
{
@@ -202,8 +205,11 @@ void PartInstance::setSize(Vector3 newSize)
size = Vector3(sizex, sizey, sizez);
- g_dataModel->getEngine()->deleteBody(this);
- g_dataModel->getEngine()->createBody(this);
+ if(this->physBody != NULL)
+ {
+ g_dataModel->getEngine()->deleteBody(this);
+ g_dataModel->getEngine()->createBody(this);
+ }
}
Vector3 PartInstance::getSize()
{
@@ -224,8 +230,11 @@ void PartInstance::setShape(Enum::Shape::Value shape)
this->shape = shape;
this->setSize(this->getSize());
}
- g_dataModel->getEngine()->deleteBody(this);
- g_dataModel->getEngine()->createBody(this);
+ if(this->physBody != NULL)
+ {
+ g_dataModel->getEngine()->deleteBody(this);
+ g_dataModel->getEngine()->createBody(this);
+ }
changed = true;
}
@@ -238,8 +247,11 @@ void PartInstance::setPosition(Vector3 pos)
void PartInstance::setAnchored(bool anchored)
{
this->anchored = anchored;
- g_dataModel->getEngine()->deleteBody(this);
- g_dataModel->getEngine()->createBody(this);
+ if(this->physBody != NULL)
+ {
+ g_dataModel->getEngine()->deleteBody(this);
+ g_dataModel->getEngine()->createBody(this);
+ }
}
bool PartInstance::isAnchored()
diff --git a/src/source/XplicitNgine/XplicitNgine.cpp b/src/source/XplicitNgine/XplicitNgine.cpp
index 36850d6..73b5eb5 100644
--- a/src/source/XplicitNgine/XplicitNgine.cpp
+++ b/src/source/XplicitNgine/XplicitNgine.cpp
@@ -11,6 +11,7 @@
XplicitNgine::XplicitNgine()
{
+
physWorld = dWorldCreate();
physSpace = dHashSpaceCreate(0);
contactgroup = dJointGroupCreate(0);
@@ -19,7 +20,7 @@ XplicitNgine::XplicitNgine()
dWorldSetAutoDisableFlag(physWorld, 1);
dWorldSetAutoDisableLinearThreshold(physWorld, 0.5F);
dWorldSetAutoDisableAngularThreshold(physWorld, 0.5F);
- dWorldSetAutoDisableSteps(physWorld, 40);
+ dWorldSetAutoDisableSteps(physWorld, 20);
this->name = "PhysicsService";
//dGeomID ground_geom = dCreatePlane(physSpace, 0, 1, 0, 0);
@@ -39,6 +40,7 @@ void collisionCallback(void *data, dGeomID o1, dGeomID o2)
dBodyID b1 = dGeomGetBody(o1);
dBodyID b2 = dGeomGetBody(o2);
+
if (b1 && b2 && dAreConnected(b1, b2))
return;
@@ -170,7 +172,6 @@ void XplicitNgine::createBody(PartInstance* partInstance)
float rotation [12] = { g3dRot[0][0], g3dRot[0][1], g3dRot[0][2], 0,
g3dRot[1][0], g3dRot[1][1], g3dRot[1][2], 0,
g3dRot[2][0], g3dRot[2][1], g3dRot[2][2], 0};
-
dGeomSetRotation(partInstance->physGeom[0], rotation);
dBodySetRotation(partInstance->physBody, rotation);