diff --git a/Blocks3D.vcproj b/Blocks3D.vcproj index dd4dfb1..d92fa8e 100644 --- a/Blocks3D.vcproj +++ b/Blocks3D.vcproj @@ -172,7 +172,7 @@ /> 0) { for (i=0; iphysWorld,g_xplicitNgine->contactgroup,contact+i); - dJointAttach (c,dGeomGetBody(o1),dGeomGetBody(o2)); + + // Create joints + dJointID c = dJointCreateContact( + g_xplicitNgine->physWorld, + g_xplicitNgine->contactgroup, + contact+i + ); + + dJointAttach (c,b1,b2); } } } @@ -66,13 +72,14 @@ void XplicitNgine::createBody(PartInstance* partInstance) // init body partInstance->physBody = dBodyCreate(physWorld); - // init geom + // Create geom partInstance->physGeom[0] = dCreateBox(physSpace, partInstance->getSize()[0], partInstance->getSize()[1], partInstance->getSize()[2] ); + // Debug output dVector3 result; dGeomBoxGetLengths(partInstance->physGeom[0], result); printf("[XplicitNgine] Part Geom Size: %.1f, %.1f, %.1f\n", @@ -81,8 +88,8 @@ void XplicitNgine::createBody(PartInstance* partInstance) result[2] ); + // Create rigid body printf("[XplicitNgine] Created Geom for PartInstance\n"); - dBodySetPosition(partInstance->physBody, partInstance->getPosition()[0], partInstance->getPosition()[1], @@ -91,22 +98,17 @@ void XplicitNgine::createBody(PartInstance* partInstance) printf("[XplicitNgine] Created Body for PartInstance\n"); - dGeomSetBody(partInstance->physGeom[0], partInstance->physBody); + if(!partInstance->anchored) + dGeomSetBody(partInstance->physGeom[0], partInstance->physBody); + } else { - // There is 100% a better way of doing this, but for now, anchored parts can be like this? - if(partInstance->anchored) { - dBodySetPosition(partInstance->physBody, - partInstance->getPosition()[0], - partInstance->getPosition()[1], - partInstance->getPosition()[2] - ); - - dBodySetLinearVel(partInstance->physBody, 0, 0, 0); - } + if(partInstance->anchored) + return; const dReal* physPosition = dBodyGetPosition(partInstance->physBody); - // I hate matricies + // TODO: Rotation code + // Probably should be done AFTER we get physics KINDA working!!! const dReal* physRotation = dGeomGetRotation(partInstance->physGeom[0]); partInstance->setPosition(Vector3(physPosition[0], physPosition[1], physPosition[2]));