Hi all
I would like to find out how to curve these values correctly in my demo, the camera, I need some help as well with the collision detection.
Any suggestions ?
#include "DarkSDK.h"
float CamX=0.0f;
float CamY=0.0f;
float CamZ=0.0f;
float OldCamX;
float OldCamY;
float PlayerX=0.0f;
float PlayerY=0.0f;
float PlayerZ=0.0f;
void init();
void init()
{
// set caption
dbSetWindowTitle("demo2");
CamX=10.0f;
CamY=10.0f;
CamZ=-10.0f;
PlayerX=5.0f;
PlayerY=7.0f;
dbPositionCamera(CamX,CamY,CamZ);
//dbPointCamera(10,10,0);
dbPositionLight(0,10,10,0);
dbLoadImage("algaebricks.bmp",2000);
dbMakeObjectSphere(3000,1,10,20);
dbPositionObject(3000,PlayerX,PlayerY,PlayerZ);
dbSetObjectCollisionOn ( 3000 );
dbSyncRate(60);
}
void DarkSDK(void)
{
char* czLevel[50];
czLevel[0] = "1111111111";
czLevel[1] = "1000000001";
czLevel[2] = "1110000001";
czLevel[3] = "1000000001";
czLevel[4] = "1001111001";
czLevel[5] = "1000000001";
czLevel[6] = "1000000001";
czLevel[7] = "1000000111";
czLevel[8] = "1000000001";
czLevel[9] = "1111111111";
int BlockPosX = 0;
int ObjNum=1;
init();
dbAutoCamOff();
dbSyncOn();
for (int x = 0; x < 10 ;x ++)
{
for (int y = 10; y >= 0; y--)
{
BlockPosX++;
ObjNum++;
switch(czLevel[x][y])
{
case '1':
dbMakeObjectBox ( ObjNum, 3, 3, 3);
dbPositionObject( ObjNum,y*3,dbAbs((x-10)*3) ,0);
dbTextureObject(ObjNum,2000);
// not working
dbSetObjectCollisionToBoxes(ObjNum);
break;
case '2':
dbMakeObjectBox ( ObjNum, 5, 3, 3);
dbPositionObject( ObjNum,y*3,x*3,0);
break;
}
}
}
while(LoopSDK())
{
OldCamX = CamX;
if (dbEscapeKey())
return;
if(dbRightKey()==1){
PlayerX=PlayerX+0.1f;
}
if(dbLeftKey()==1){
PlayerX=PlayerX-0.01f;
}
if(dbUpKey()==1){
PlayerY=PlayerY+0.01f;
}
if(dbDownKey()==1){
PlayerY=PlayerY-0.01f;
}
// not working
CamX = dbCurveValue(PlayerX,OldCamX,0.001f);
CamY = dbCurveValue(PlayerY,OldCamY,1.0f);
dbPositionCamera(CamX,CamY,CamZ);
dbPositionObject(3000,PlayerX,PlayerY,PlayerZ);
dbSync();
}
}