There seems to be quite a few posts about problems with collision and directX models. I am having a problem with them as well. I am using the Delgine creator by Deled to create my .X model and they are importing into DarkGDK just fine. However I am having a problem ray casting a collision with with them. Below is the code I wrote to create the level terrain.
void DoCreateTerrain()
{
//load the terrain
dbSetDir(myGameDirectory);
dbSetDir("Data");
dbSetDir("Levels");
dbLoadImage("Start Zone Textures.jpg", 10);
dbLoadImage("Rocks.jpg", 20);
dbSetupTerrain();
dbMakeObjectTerrain(1);
dbSetTerrainHeightMap(1, "Start Zone Map.jpg");
dbSetTerrainScale(1, 3.0f, 0.6f, 3.0f);
dbSetTerrainLight(1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f);
dbSetTerrainTexture(1, 10, 20);
dbBuildTerrain(1);
SC_SetupComplexObject(1, 1, 2);
//load the tower model
dbSetDir(myGameDirectory);
dbSetDir("Data");
dbSetDir("Models");
dbLoadObject ("tower.x", 10);
dbScaleObject(10, 6, 6, 6);
dbPositionObject(10, 510, -1, 419);
dbSetObjectLight (10, 0 );
SC_SetupObject(10, 1, 0);
dbMakeObjectBox(15, 2, 6, 1);
dbPositionObject(15, 510, 3, 474);
SC_SetupObject(15, 1, 2);
dbMakeObjectBox(16, 16, 8, 1);
dbPositionObject(16, 520, 4, 474);
SC_SetupObject(16, 1, 2);
}
You will notice that there are four object created. The first is the terrain created form a bitmap image. The second is a .X file called tower. The third and fourth are two boxes, walls so to speak. I can get Sparkys raycast collision to find the ground, and the two boxes. When my Character collides with them it stops like it should. However I cannot seem to get any collision data with the tower. Anyone have any ideas?