Alright, I got BSP maps to load and got collision working and such, HOORAY!
However, now I started playing with the physics kit from the sticky post above. My goal is to create boxes at the location of the camera, make them fall due to gravity and bounce, or slide or do something when they hit the BSP geometry.
I can drop boxes, and make them hit the ground and stick without the physics pack. I could also write code to handle the collisions but wanted to try out this physics pack (ODEPhysics.NET). Here is my code snippet:
if (oDBInput.SpaceKey() != 0 && (oDBCore.Timer() - fLast) > 100)
{
fLast = oDBCore.Timer();
nObj++;
oBall.m_nObj = nObj;
oBall.m_fTimer = oDBCore.Timer();
myBalls.Add(oBall);
oDB3D.MakeObjectBox(nObj, .2f, .2f, .2f);
oDB3D.PositionObject(nObj, oDBCamera.CameraPositionX(), oDBCamera.CameraPositionY(), oDBCamera.CameraPositionZ());
oODE.ODE_CreateDynamicSphere(nObj);
oODE.ODE_SetContactFDir1(nObj, 0.5f);
oODE.ODE_SetBodyMass(nObj, 10);
oDBWorld.SetBSPObjectCollision(nObj, nObj, oDB3D.ObjectSize(nObj), 1);
oDB3D.AutomaticObjectCollision(nObj, oDB3D.ObjectSize(nObj), 0);
}
oDBText.Text(0, 0, "Use Mouse to Free Look (0,0)");
oDBText.Text(0, 12, "Timer: " + Convert.ToString(oDBCore.Timer()));
oDBText.Text(0, 24, "nObj: " + Convert.ToString(nObj));
oDBText.Text(0, 36, "Camera at: " + Convert.ToString(oDBCamera.CameraPositionX()) + "," + Convert.ToString(oDBCamera.CameraPositionY()) + "," + Convert.ToString(oDBCamera.CameraPositionZ()));
if (nObj > 0)
{
oDBText.Text(0, 48, "Ball 0 at: " + Convert.ToString(oDB3D.ObjectPositionX(1)) + "," + Convert.ToString(oDB3D.ObjectPositionY(1)) + "," + Convert.ToString(oDB3D.ObjectPositionZ(1)));
}
oDBCore.Sync();
oODE.ODE_Update();
if I include the line (oODE.ODE_Update()
the boxes just fall through the world and keep going. If I comment out that line (and add in my own code for gravity) the boxes fall and stick to the ground.
So to you experienced guys and gals, got a tip on using the ODEPhysics.NET? Or just write my own stuff to handle the collisions?
Requirements for life: Food-Water-Video Games!