Ok, not really too much help on my last post, so here's hoping that this one will go better. i have a function to control a player defined as so:
void ControlPlayer (int object, float y_pos, int collideObj)
{
dbSetObjectToCameraOrientation (object);
float OldPlayerX = dbObjectPositionX (object);
float OldPlayerY = dbObjectPositionY (object);
float OldPlayerZ = dbObjectPositionZ (object);
if (dbUpKey () || dbKeyState (17))
{
dbMoveObject (object, 20.0f);
dbPositionObject (object, dbObjectPositionX (object), y_pos, dbObjectPositionZ (object));
}
if (dbDownKey () || dbKeyState (31))
{
dbMoveObject (object, -20.0f);
dbPositionObject (object, dbObjectPositionX (object), y_pos, dbObjectPositionZ (object));
}
if (dbLeftKey () || dbKeyState (30))
{
dbYRotateCamera (0, dbCameraAngleY () - 90);
dbSetObjectToCameraOrientation (object);
dbMoveObject (object, 20.0f);
dbYRotateCamera (0, dbCameraAngleY () + 90);
dbPositionObject (object, dbObjectPositionX (object), y_pos, dbObjectPositionZ (object));
}
if (dbRightKey () || dbKeyState (32))
{
dbYRotateCamera (0, dbCameraAngleY () + 90);
dbSetObjectToCameraOrientation (object);
dbMoveObject (object, 20.0f);
dbYRotateCamera (0, dbCameraAngleY () - 90);
dbPositionObject (object, dbObjectPositionX (object), y_pos, dbObjectPositionZ (object));
}
float PlayerPosX = dbObjectPositionX (PLAYER);
float PlayerPosY = dbObjectPositionY (PLAYER);
float PlayerPosZ = dbObjectPositionZ (PLAYER);
if (SC_SphereCast (PLAYER, PlayerPosX, PlayerPosY+20,PlayerPosZ,PlayerPosX, PlayerPosY+20, PlayerPosZ, 20, 0) == collideObj)
{
dbPositionObject (PLAYER, OldPlayerX, OldPlayerY, OldPlayerZ);
}
else
{
dbPositionObject (PLAYER, PlayerPosX, PlayerPosY, PlayerPosZ);
}
}
I am using SC_SphereCast to try to detect collision with my walls, however, this code will not prevent me from colliding with the walls. when i tried to modify the parameters for SC_SphereCast, I was prevented from walking through the walls, but could only walk one direction on the z-axis. seriously guys, what am i doing wrong and how do i do this???