Hurrah, working code! Alright folks consider this thread almost done, just time for the closing remarks from those who made this thread possible.
The answer to the question:
?: "Dark GDK / DGK C++: How to make a .X object for collision 3d World Studio"
A: Using Sparkies Collision
SC_SetupObject(iObjectID,0,0);
Setting the collision to use the polygon collision.
Here is the bit of code for everbody to wonder over... This is not clean at all, it was mostly for protyping to see if I could do it.
/ the wizard has created a very simple 3D project that uses Dark GDK
// it can be used as a starting point in making your own 3D games
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
#include "SC_Collision.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
// in this application we are going to create some 3D objects
// and position them on screen
// when starting a Dark GDK program it is useful to set global
// application properties, we begin by turning the sync rate on,
// this means we control when the screen is updated, we also set
// the maximum rate to 60 which means the maximum frame rate will
// be set at 60 frames per second
// This has to be ran before any of the psarky commands are used
SC_Start();
// some varibles I used for the program
float fMouseX;
float fMouseY;
int iButtonID;
int iSpriteCollision;
// standard
dbSyncOn ( );
dbSyncRate ( 60 );
// set our random seed to a value from the timer, this will help
// to ensure each time we run our program the random values appear
// more random
dbRandomize ( dbTimer ( ) );
dbSync();
// Load some music and splash screen
dbLoadMusic("hntr2end.mp3",1);
dbLoadImage("SplashScreen.png",1);
dbPasteImage(1,0,0);
dbPlayMusic(1);
dbSync();
// Load the arrows up
dbLoadImage("32x32arrow.bmp",2);
dbLoadImage("32x32arrow2.bmp",3);
dbLoadImage("32x32arrow3.bmp",4);
dbLoadImage("32x32arrow4.bmp",5);
dbLoadImage("32x32arrow4t.bmp",6);
dbLoadImage("32x32arrow4ud.bmp",7);
dbLoadImage("cursor.png",8);
dbLoadImage("cursor3.png",10);
dbLoadImage("unknownblock.png",9);
// Create the Test Box
int iCOid = 1;
dbMakeObjectBox(iCOid,10,10,10);
dbTextureObject(iCOid,9);
// This is Sparkys Code, Active the Collision and type
SC_SetObjectCollisionOn(iCOid);
SC_SetupObject(iCOid,0,2);
// position the object in a random location
dbPositionObject ( iCOid, dbRnd ( 20 ), dbRnd ( 20 ), dbRnd ( 20 ) );
int iI = 51;
// this is the "Testmap" from 3d World Studio
dbLoadObject("testmap.x",iI);
SC_SetupObject(iI,0,0);
SC_SetObjectCollisionOn(iI);
// move our camera back so we can view the objects
dbPositionCamera ( 10, 10, -20 );
// Stop the music and hide the mouse (using a sprite to sprite detect mode)
dbStopMusic(1);
dbHideMouse();
// now we come to our main loop, we call LoopGDK so some internal
// work can be carried out by the GDK
while ( LoopGDK ( ) )
{
// I found this by accident, this updates the collision objects
SC_UpdateObject(1);
SC_UpdateObject(51);
// Sprites for the screen & simple mouse buttons
// Move / Forward / Backward /Side to Side
dbSprite(2,0,64,2);
dbSprite(3,64,64,3);
dbSprite(4,32,32,4);
dbSprite(5,32,96,5);
dbPasteImage(6,32,64);
// Move / Up and Down
dbPasteImage(7,96,64);
dbSprite(6,96,32,4);
dbSprite(7,96,96,5);
// Place Mouse and Dector
fMouseX = dbMouseX();
fMouseY = dbMouseY();
if (fMouseY<1 || fMouseY>dbScreenHeight()) dbShowMouse(); else dbHideMouse();
dbSprite(9,fMouseX,fMouseY,8);
dbSprite(8,fMouseX,fMouseY,10);
// display some text on screen
dbText ( 0, 0, "Use the up and down arrow keys to move the camera" );
// move the camera forwards
if ( dbUpKey ( ) )
dbMoveCamera ( 1 );
// move the camera backwards
if ( dbDownKey ( ) )
dbMoveCamera ( -1 );
dbPointCamera( dbObjectPositionX (iCOid),dbObjectPositionY (iCOid),dbObjectPositionZ (iCOid));
// rotate all of our objects
// dbRotateObject ( iCOid, dbObjectAngleX ( iCOid ) + 0.1, dbObjectAngleY ( iCOid ) + 0.2, dbObjectAngleZ ( iCOid ) + 0.3 );
// Check for Commands
iButtonID = dbMouseClick();
if (iButtonID>0)
{
// Check for Sprite Collision on Buttons
// Up
iSpriteCollision = dbSpriteHit(8,6);
if (iSpriteCollision == 1)
{
dbMoveObjectUp ( iCOid, 1.0 ) ;
}
// down
iSpriteCollision = dbSpriteHit(8,7);
if (iSpriteCollision == 1)
{
dbMoveObjectDown ( iCOid, 1.0 ) ;
}
// Left
iSpriteCollision = dbSpriteHit(8,2);
if (iSpriteCollision == 1)
{
dbMoveObjectLeft ( iCOid, 1.0 ) ;
}
// Right
iSpriteCollision = dbSpriteHit(8,3);
if (iSpriteCollision == 1)
{
dbMoveObjectRight ( iCOid, 1.0 ) ;
}
// Forward
iSpriteCollision = dbSpriteHit(8,4);
if (iSpriteCollision == 1)
{
dbMoveObject( iCOid, 1.0 ) ;
}
// Backward
iSpriteCollision = dbSpriteHit(8,5);
if (iSpriteCollision == 1)
{
dbMoveObject ( iCOid, -1.0 ) ;
}
}
// Test Collision Between Object and everything else
if (SC_ObjectCollision ( 1, 51 )==1)
{
dbPasteImage(9,16,16);
}
// here we make a call to update the contents of the screen
dbSync ( );
}
// before quitting delete our objects
dbDeleteObject(iCOid);
dbDeleteObject(iI);
// and now everything is ready to return back to Windows
return;
}
One observation is that when my little box went inside the bigger structure, it was no longer colliding. Not sweating it though.
I think I will right up a code snippit, for the code base with a clean code set.
The download is just a .bmp screenshot of the workscreen.
Thanks for the help folks. Timidon going to bed. Sparkies Collision system works. I will have to experiment a bit more.
There are many answers but just one question" ~ Jerilith the Mad