UPDATE:
I got the follow code now:
int collide = SC_RayCast( 0, oldx, oldy, oldz, position.x, position.y, position.z, 0 );
if ( collide ){
int collidefloor = SC_RayCast( 0, oldx, oldy + 2, oldz, position.x, position.y + 2, position.z, 0 );
if ( !collidefloor ){
position.y += 2;
} else {
position.x = oldx;
position.y = oldy;
position.z = oldz;
}
} else {
int collidefloor = SC_RayCast( 0, oldx, oldy - 1, oldz, position.x, position.y - 1, position.z, 0 );
if( !collidefloor ){
position.y -= 1;
}
}
But the problem now that he go trough the floor instead of stopping...
Any solutions?
Alexw