hey, I'm trying to give player simple, yet effective gravity. This is what I have so far (in my real code I defined all variables and skills off course):
Code:
my.eflags |= FAT | NARROW;
while(1){
//trace down for gravity
floor_dist = c_trace(my.x,vector(my.x,my.y,my.z-1280),IGNORE_ME|IGNORE_PASSABLE|IGNORE_PASSENTS|IGNORE_MODELS|IGNORE_SPRITES|USE_BOX);

if(floor_dist<=4){
   my.move_vec_z = 0;
}else{
   my.move_vec_z = -((floor_dist/8)+4);
}

my.move_vec_z = clamp(my.move_vec_z,-24,0);
c_move(me,vector(my.move_vec_x,my.move_vec_y,0),vector(0,0,my.move_vec_z),IGNORE_ME|IGNORE_PASSABLE|GLIDE);

wait(1);
}



The problem is with sloping sections. When I go up it's all fine, but when i'm going down it kind of stutters (because of the continuous trace down/gravity down).

Can someone tell me how to fix this without getting a big workaround code and all. (strairs by te way work just fine to and in main i call move_min_z = -1;)

Thanks.