Hi folks, i have this quite weird problem take a look
[Edit], wow you could actually edit :S, now here is the Image
And here is the code:
#include "DarkGDK.h"
#include "SC_Collision.h"
float zoom = 150,angle = 270, angleY = 90, x=0,y=0,z=0;
bool crouched=false,idle=true;
void DarkGDK ( void )
{
//Should Only be run if game has been released
dbSetDisplayMode( 1680, 1050, 32 );
dbSetWindowOff();
dbMaximizeWindow();
dbSyncOn ( );
dbSyncRate ( 60 );
dbHideMouse();
dbPrint ( "Please wait loading models..." );
dbSync ( );
dbSync ( );
SetCurrentDirectory("Data");
dbAutoCamOff();
dbSetNormalizationOn();
dbSetGlobalShadowsOn();
// set min camera range to 10 .... nothing is happening closer to the cam than this at least...
dbColorBackdrop( dbRGB(0, 0, 0) );
//dbSetCameraRange(0,500);
dbPositionCamera ( 0, 90, -100 );
dbPointCamera( 0,0,10);
// Lightning will be needed in order to have the shadows work correct
dbSetPointLight(0, 0, 2500, 0);
//dbSetAmbientLight( 0 );
// lowered the scale of you objects, too large and you need to compensate with various methods
//dbMakeObjectPlane(1,500,500);
//dbPositionObject(1,0,0,0);
//dbXRotateObject(1,270);
dbColorObject(1, dbRGB(75, 185, 25));
dbSetShadowShadingOn(1,-1,1000,true); // turn on shadow shading, use hardware shader
dbSetShadowClipping(1, 1, 149); // set clipping value to be one less than max range... i find this gives best results, but you need to experiment depending on your cam angles etc
// Creates a Terrain
dbSetupTerrain ( );
dbMakeObjectTerrain (1);
dbSetTerrainHeightMap (1,"Hmap.jpg");
dbSetTerrainScale (1, 100,10,100);
dbPositionObject(1,0,-100,0);
dbSetTerrainSplit (1,16);
dbSetTerrainTiling (1,4);
dbSetTerrainLight (1, 1.0f, -0.25f, 0.0f,1,1,0.78f,0.5f);
//dbSetTerrainTexture (1,1,2);
dbBuildTerrain (1);
// Actors should could use Items, this is a Stick
dbMakeObjectBox(3,1.5,50,1.5);
dbPositionObject(3,4,23,-2);
dbColorObject(3, dbRGB(175, 175, 175));
dbSetShadowShadingOn(3,-1,1000,true); // turn on shadow shading, use hardware shader
dbSetShadowClipping(3, 1, 149); // set clipping value to be one less than max range... i find this gives best results, but you need to experiment depending on your cam angles etc
// Actors should could use Items, this is a Stick
dbMakeObjectBox(4,15,15,30);
dbPositionObject(4,1.5/-4,25,1.5/-2);
dbColorObject(4, dbRGB(50, 50, 50));
dbSetShadowShadingOn(4,-1,1000,true); // turn on shadow shading, use hardware shader
dbSetShadowClipping(4, 1, 149); // set clipping value to be one less than max range... i find this gives best results, but you need to experiment depending on your cam angles etc
// Putting Hammerhead and stick together
dbGlueObjectToLimb(4, 3, 0);
dbXRotateObject(3,-10);
dbZRotateObject(3,-10);
// Needed to create a Object, or actually a Actor
dbLoadObject ( "Colonel-X.x", 2);
dbPositionObject( 2, 0, 0, 0 );
dbSetObjectSpeed ( 2, 40 );
dbSetShadowShadingOn(2,-1,1000,true);
dbSetShadowClipping(2, 0, 149);
// Attach Hammer to Actor
dbGlueObjectToLimb(3, 2, 42);
// Setting up Collision
SC_Start();
SC_SetupObject(2,2,1);
SC_SetupComplexObject(1,1,0);
SC_DrawObjectBounds(2);
short collide =0;
while ( LoopGDK ( ) )
{
dbPositionMouse ( dbScreenWidth()/2 , dbScreenHeight()/2 );
angle -= dbMouseMoveX();
angleY -= dbMouseMoveY();
if(zoom <= 40)
zoom = 40;
zoom -= dbMouseMoveZ()*0.2f;
//dbSetCameraToFollow(0,x,y+100,z,angle+90,75,11,1,0);
dbPositionCamera(0,
x+(dbCOS(angle+90)*zoom),
(y+75)/*+(-dbSIN(angle+90)*zoom)*/,
z+(dbSIN(angle+90)*zoom));
dbPointCamera(0,x,y+75,z);
/*float height = dbGetTerrainGroundHeight(1,x,z);
if(y = height)
{
y = height;*/
// Key Movement
idle = true;
if (dbKeyState (17)) // Walk 300,318
{
idle = false;
if(!crouched)
{
x += dbCOS(angle-90)*5;
z += dbSIN(angle-90)*5;
dbLoopObject ( 2,300,318 );
} else {
x += dbCOS(angle-90)*3;
z += dbSIN(angle-90)*3;
dbLoopObject(2,381,405);
}
}
if (dbKeyState (31))
{
idle = false;
if(!crouched)
{
x -= dbCOS(angle-90)*3;
z -= dbSIN(angle-90)*3;
dbLoopObject(2,235,259);
} else {
x -= dbCOS(angle-90);
z -= dbSIN(angle-90);
dbLoopObject(2,381,405);
}
}
if(dbControlKey() == 1 ) { // crouch-still-start 381,405
crouched = true;
} else { // crouch-still-stop 356,380
crouched = false;
}
if (dbKeyState( 30 ))
{
idle = false;
if(!crouched)
{
x += dbCOS(angle)*3;
z += dbSIN(angle)*3;
dbLoopObject(2,260,279);
} else {
x += dbCOS(angle);
z += dbSIN(angle);
dbLoopObject(2,381,405);
}
}
if (dbKeyState( 32 ))
{
idle = false;
if(!crouched)
{
x -= dbCOS(angle)*3;
z -= dbSIN(angle)*3;
dbLoopObject(2,280,299);
} else {
x -= dbCOS(angle);
z -= dbSIN(angle);
dbLoopObject(2,381,405);
}
}
if (dbSpaceKey() == 1)
{
y+= 25;
}
if (idle) //Idle stand 210,234, Idle Crouched
{
if(!crouched)
dbLoopObject(2,210,234);
else
dbLoopObject(2,356,380);
}
/*} else {
y-=0.0000001f;
}*/
SC_UpdateObject(2);
//collide = SC_ObjectCollision(1,2);
collide = SC_GroupCollision(2,1);
if(collide)
{
y+=1;
}
else
{
y-=9.18f;
}
dbYRotateObject(2,(-angle));
dbPositionObject(2,x,y,z);
dbSync ( );
}
return;
}