I'm trying to get the coordinates of the position some X number of units in front of my camera.
Currently I'm using this:
D3DXVECTOR3 oldPosition(dbCameraPositionX(), dbCameraPositionY(), dbCameraPositionZ());
dbMoveCamera(10000);
D3DXVECTOR3 newCameraPosition(dbCameraPositionX(), dbCameraPositionY(), dbCameraPositionZ());
dbPositionCamera(oldPosition.x, oldPosition.y, oldPosition.z);
// Now newCameraPosition has the coordinates I want
Surely this isn't optimal. I found another thread in the DarkBasic forum with a similar idea and the suggestion involved using dbPickScreen and basically feeding it the center of the screen. My camera is always at (0,0,0) and using dbPickScreen I only seem to get a Z value of 10000 with X and Y remaining zero. It appears to me that dbPickScreen only returns values relative to your camera... so matter which way I turn the camera I get the same values using dbPickScreen(dbScreenWidth/2, dbScreenHeight/2, 10000), those values being 0,0,10000.
Any thoughts from those cleverer than myself?