hi, could somebody pleas explain what am i doing wrong?????????????
#include "DarkGDK.h"
#include "SC_Collision.h"
#define W 17
#define A 30
#define S 31
#define D 32
float vx = 0;
float vy = 0;
float vz = 0;
void DarkGDK( )
{
dbSyncOn( );
dbSyncRate( 60 );
dbAutoCamOff( );
SC_Start( );
dbMakeObjectCube(1, 20);
dbPositionObject(1, 0, 0,50);
SC_SetupObject(1, 1, 2);
dbMakeObjectSphere(2, 4, 20, 20);
dbHideObject(2);
SC_SetupObject(2, 0, 1);
while( LoopGDK( ) )
{
dbPositionCamera(dbObjectPositionX(2), dbObjectPositionY(2), dbObjectPositionZ(2));
//////////
float oldx = dbObjectPositionX(2);
float oldy = dbObjectPositionY(2);
float oldz = dbObjectPositionZ(2);
float x = oldx + vx;
float y = oldy + vy;
float z = oldz + vz;
int Collide = SC_SphereSlide(1, oldx, oldy, oldz, x, oldy, z, 2, 0);
if ( Collide > 0 )
{
x = SC_GetCollisionSlideX();
oldy = SC_GetCollisionSlideY();
z = SC_GetCollisionSlideZ();
vx = 0;
vz = 0;
dbPositionObject( 2,x,oldy,z );
SC_UpdateObject( 2 );
}
//////////
if(dbKeyState(W))
{
dbMoveObject(2, 0.5);
}
if(dbKeyState(S))
{
dbMoveObject(2, -0.3);
}
if(dbKeyState(A))
{
dbMoveObjectLeft(2, 0.3);
}
if(dbKeyState(D))
{
dbMoveObjectRight(2, 0.3);
}
dbSync( );
}
}
oh and also one question how could i get SC_IntersceptOb... to return me the distaance betven me and the level(i need this to position the camera at sercent height)
Game.Love