Hey all!
The story (skipable):
Long time no see (I guess it's been almost 5 years )
I'm currently developing my graduation project ,it's mostly a hardware related multi-user interface prototype and as our drivers began to come out of alpha stage I was given the task of creating a freeware demo app (simple RTS like game) with a month's deadline...It's ok... I've survived worse deadlines ("compiler in a month" was definitely worse!)...
as DBP has saved my neck several times in the past, I decided that I'd finally try DarkGDK together DarkPhysics..
The good:
DarkGDK is exactly how I remember DBP (meaning rapid development)
The Bad:
DarkGDK is exacly how I remember DBP... I'm from before Upgrade 6
Anyhow, just cause the deadline is tight it doesn't mean I won't give a little back to the community, the following workaround is suitable for HUDs and Menu's made from known objects (objects whose numbers we already know to be in a specific range) , make sure no other objects are in this range otherwise if they are close to the space origin they may cause interference in the process...
The Problem:
The function dbPickObject() in DGDK is equivalent to the old DBP's pick object command, which did not take a "ignore camera" flag.
Today's Workaround:
I'd code the linear algebra needed myself if I it wasn't for this deadline of mine ... However in order to finish my project in time I've used the KISS approach :
* save the camera position and rotation
* reposition and rotate to default @ origin
* use PickObject
* reposition and rotate to the saved location
I don't claim this to be an original Idea at all, but since I couldn't find anything related with a simple search I thought this might help people in a similar situation
//from my main loop
float cx = dbCameraPositionX();
float cy = dbCameraPositionY();
float cz = dbCameraPositionZ();
float cax = dbCameraAngleX();
float cay = dbCameraAngleY();
float caz = dbCameraAngleZ();
dbPositionCamera(0,0,0);//positions @ origin
dbRotateCamera(0,0,0);
sprintf(buffer,"is it over the menu object? %d", dbPickObject(dbMouseX(),dbMouseY(),50,50));
dbText ( 0, 0, buffer );
dbPositionCamera(cx,cy,cz);//positions it back
dbRotateCamera(cax,cay,caz);
Diego "Proteus" Spinola
Electrical Engineer
Emphasis on Computer and Digital Systems Engineering