For those people that want to pick an object on the screen and move it using the mouse, here's a little bit of code for you ;]
dbPositionCamera ( 4, 4, 4);
dbPointCamera (4, 4, 19);
while ( LoopGDK ( ) )
{
int a = dbPickObject (dbMouseX(), dbMouseY(), 1, j);
if ( a > 0 && dbMouseClick() == 1 /*&& dbMouseMoveZ() != 0*/)
{
dbPickScreen (dbMouseX(), dbMouseY(), 19);
dbPositionObject (a, dbGetPickVectorX() + dbCameraPositionX(), dbGetPickVectorY() + dbCameraPositionY(), 19);
dbSync ( );
}
dbSync ( );
}
When you click on an object in 3d space, you get the "vector" to it from the camera - as in the position of the object as if the camera was placed at 0,0,0 - to get the actual position of the object you add the two locations together to give you the true position of the object in 3d space.
You hold down the left mouse button, it becomes tied to your mouse pointer, you get to move it around, you let go of the left mouse button.
What I did find interesting was that the object would have a slight curve to their movement. It's like moving something with a magnet through some very thick glass
You can experiment with the dbSetCameraFOV ( Angle ); command for some different results (the angles available end at 360).
why doesn't it work the way I want it to!