Sure thing. This is the collision function i am using:
void MovePlayer()
{
float oldx = dbObjectPositionX(playervar);
float oldy = dbObjectPositionY(playervar);
float oldz = dbObjectPositionZ(playervar);
if(!dbKeyState(32) & !dbKeyState(30))
{
timer = 0.0f;
mSpeed = 0.0f;
}
dbPositionObject(playervar,dbObjectPositionX(playervar),dbObjectPositionY(playervar)+gravity,dbObjectPositionZ(playervar));
if(dbKeyState(32))
{
if(timer < 13)
{
timer = timer + 0.4f;
}
if(mSpeed < 0.36444)
{
mSpeed = mSpeed + 0.06f;
}
dbZRotateObject(playervar,dbObjectAngleZ(playervar)-timer);
dbZRotateObject(900,dbObjectAngleZ(playervar)-timer);
dbPositionObject(playervar,dbObjectPositionX(playervar)+mSpeed,dbObjectPositionY(playervar),dbObjectPositionZ(playervar));
}
if(dbKeyState(30))
{
if(mSpeed < 0.36444)
{
mSpeed = mSpeed + 0.06f;
}
if(timer < 13)
{
timer = timer + 0.3f;
}
dbZRotateObject(playervar,dbObjectAngleZ(playervar)+timer);
dbZRotateObject(900,dbObjectAngleZ(playervar)+timer);
dbPositionObject(playervar,dbObjectPositionX(playervar)-mSpeed,dbObjectPositionY(playervar),dbObjectPositionZ(playervar));
}
if(dbSpaceKey())
{ jSpeed = jSpeed - 0.07f;
dbPositionObject(playervar,dbObjectPositionX(playervar),dbObjectPositionY(playervar)+jSpeed,dbObjectPositionZ(playervar));
}
if(!dbSpaceKey() && collision == 1)
{
//if(!SC_ObjectCollision(playervar,71) > 0)
//{
jSpeed = 1.4f;
//}
}
float newx = dbObjectPositionX(playervar);
float newy = dbObjectPositionY(playervar);
float newz = dbObjectPositionZ(playervar);
int collide = SC_SphereSlideGroup ( 1, oldx,oldy,oldz, newx,newy,newz,radius, 0 );
if(collide > 1)
{
collision = 1;
dbPositionObject(playervar,SC_GetCollisionSlideX(),SC_GetCollisionSlideY(),SC_GetCollisionSlideZ());
}
else
{
collision = 0;
}
SC_UpdateObject( playervar );
}
The level has been setup as:
SC_SetupComplexObject(70,1,1 );
//and the character
SC_SetupObject( playervar,0,1 );
Any ideas?