I figured out what was wrong while waiting for the mods to approve my post =]
Here is what the code has ended up looking like:
void moveObject( int objnum, int mtype )
{
float oldx = dbObjectPositionX(objnum);
float oldy = dbObjectPositionY(objnum);
float oldz = dbObjectPositionZ(objnum);
float angy = dbObjectAngleY(objnum);
vx = 0;
vz = 0;
if ( vy == 0 && jumptimer == 0 ) vy = vy + 10*gravity;
else vy = vy + gravity;
if (mtype == 0 ) { vx = 0; vz = 0; }
if (mtype == 1 ) { vx = vx - dbCos(angy)/9; vz = vz + dbSin(angy)/9; }
if (mtype == 2 ) { vx = vx + dbCos(angy)/9; vz = vz - dbSin(angy)/9; }
if (mtype == 3 ) { vx = vx + dbSin(angy)/9; vz = vz + dbCos(angy)/9; }
if (mtype == 4 ) { vx = vx - dbSin(angy)/9; vz = vz - dbCos(angy)/9; }
if ( mtype == 5 && jumptimer == 0 && ground == 1 )
{
vy = vy + jpwr;
jumptimer = 120;
}
float x = oldx + vx;
float y = oldy + vy;
float z = oldz + vz;
int collide = SC_SphereCastGroup( 1, oldx,oldy,oldz, oldx,oldy+vy,oldz, radius,0 );
if ( collide > 0 )
{
float ny = SC_GetCollisionNormalY();
if ( dbAbs(ny) > slope )
{
oldy = SC_GetStaticCollisionY();
}
else
{
x = x - oldx; z = z - oldz;
oldx = SC_GetCollisionSlideX();
oldy = SC_GetCollisionSlideY();
oldz = SC_GetCollisionSlideZ();
x = x + oldx; z = z + oldz;
}
if ( ny > slope )
{
ground = 1;
vy = 0;
}
else
{
ground = 0;
if ( ny < -slope ) vy = gravity;
}
}
else
{
oldy = oldy + vy;
ground = 0;
}
if ( ground == 1 && jumptimer > 0 ) jumptimer--;
collide = SC_SphereSlideGroup( 1, oldx,oldy,oldz, x,oldy,z, radius,0 );
if ( collide > 0 )
{
x = SC_GetCollisionSlideX();
oldy = SC_GetCollisionSlideY();
z = SC_GetCollisionSlideZ();
vx = 0;
vz = 0;
}
dbPositionObject( objnum,x,oldy,z );
SC_UpdateObject( objnum );
}
and:
void Player_Control()
{
if ( dbSpaceKey() == 1 )
{
SC_UpdateObject ( 3 );
moveObject( 3, 5 );
}
if ( dbKeyState(17) )
{
SC_UpdateObject ( 3 );
moveObject( 3, 4 );
}
if ( dbKeyState(31) )
{
SC_UpdateObject ( 3 );
moveObject( 3, 3 );
}
if ( dbMouseClick() == 2 )
{
if (dbKeyState(30))
{
SC_UpdateObject ( 3 );
moveObject( 3, 2 );
}
if (dbKeyState(32))
{
SC_UpdateObject ( 3 );
moveObject( 3, 1 );
}
}
When I used this code in my origional 'map' it did not work what so ever, I tried it in a different 'map' and it sort of works except the character is off the ground a few units which im not too concerned with. I don't know what was wrong with the origional .x file itself, i'll just have to try to make a new one.