I tried this (Im leaving the no creating a cube where another one is out of it) but I get a undeclared variable error and the mouse does not stay at the center of the screen.
mm3dX=xHit;
mm3dZ=zHit;
mm3dY=yHit;.
void DarkGDK ( void ) {
dbSyncOn();
dbSyncRate(60);
int x = 1;
//Loop
while( LoopGDK ( ) ) {
int mousex = dbMouseX();
int mousez = dbMouseZ();
int mousey = dbMouseY();
if (dbKeyState(57) == 1)
dbPositionMouse( dbScreenWidth() / 2, dbScreenHeight() / 2 );
{
dbMakeObjectCube(x,20);
dbPositionObject(x,mousex,mousey,0);
dbWait(100);
}
dbPositionCamera(0,mousex,mousey,mousez-100);
dbText(0,0,dbStr(int(x)));
dbSync();
}
}
void mouseConvert()
{
double pickVector =0;
float xHit =0;
float zHit=0;
float yHit=0;
dbPickScreen ( dbMouseX(), dbMouseY(),1200 ) ;
xHit = dbGetPickVectorX() + dbCameraPositionX(); //Pick the x and z location on 3d terrain of mouse location
zHit = dbGetPickVectorZ() + dbCameraPositionZ();//-dbCameraPositionY();
yHit = dbGetPickVectorY() + dbCameraPositionY();//-dbCameraPositionY();
mm3dX=xHit;
mm3dZ=zHit;
mm3dY=yHit;
}
EDIT: tried this and it runs, but it's really glitchy
#include "DarkGDK.h"
#include "DarkPhysics.h"
#include "DarkAI.h"
#include "DarkLights.h"
#include "ShaderData.h"
#pragma comment ( lib, "DarkPhysics.lib" )
#pragma comment ( lib, "DarkAI.lib" )
#pragma comment ( lib, "DarkLights.lib" )
#pragma comment ( lib, "ShaderData.lib" )
void DarkGDK ( void ) {
dbSyncOn();
dbSyncRate(60);
int x = 1;
float mm3dX = 1;
float mm3dY = 1;
float mm3dZ = 1;
//Loop
while( LoopGDK ( ) ) {
int mousex = dbMouseX();
int mousez = dbMouseZ();
int mousey = dbMouseY();
if (dbKeyState(57) == 1)
dbPositionMouse( dbScreenWidth() / 2, dbScreenHeight() / 2 );
{
dbMakeObjectCube(x,20);
dbPositionObject(x,mousex,mousey,0);
dbWait(100);
}
dbPositionCamera(0,mousex,mousey,mousez-100);
dbText(0,0,dbStr(int(x)));
dbSync();
}
}
void mouseConvert()
{
double pickVector =0;
float xHit =0;
float zHit=0;
float yHit=0;
float mm3dX=0;
float mm3dY=0;
float mm3dZ=0;
dbPickScreen ( dbMouseX(), dbMouseY(),1200 ) ;
xHit = dbGetPickVectorX() + dbCameraPositionX(); //Pick the x and z location on 3d terrain of mouse location
zHit = dbGetPickVectorZ() + dbCameraPositionZ();//-dbCameraPositionY();
yHit = dbGetPickVectorY() + dbCameraPositionY();//-dbCameraPositionY();
mm3dX=xHit;
mm3dZ=zHit;
mm3dY=yHit;
}
Always program as if the person maintaining your program is a psychopath that knows where you live