Hello, everyone
I am using the usual gravity code from the AUM ,with some modification to make something like acceleration:
I put the following in a while loop:
VECTOR temp, gravity_speed;
var distance_to_ground;
var max_gravity = -10*time_step;
vec_set(temp.x,my.x);
temp.z -= 5000;
distance_to_ground = c_trace(my.x,temp.x,IGNORE_ME | USE_BOX | IGNORE_PASSABLE);
gravity_speed.z = -(distance_to_ground - 17);
gravity_speed.z = clamp(gravity_speed.z,max_gravity,5);
max_gravity += -5*time_step;
max_gravity = clamp(max_gravity,-35*time_step,-10*time_step);
gravity_speed.x = 0;
gravity_speed.y = 0;
c_move(my,nullvector,gravity_speed.x,GLIDE | IGNORE_PASSABLE);
if(distance_to_ground <= 0.1) max_gravity = -10*time_step;
1) First, I want to increase the efficiency of the code and I mean the value 17 (in seventh line) ,how to set a proper value that suits the model (distance between the origin and feet) 'cause I tried that a lot using vec_for_min and stuff ,but it didn't work and the model moves upwards
I added this before the code above:
vec_for_min(temp2.x,my);
leg_height = my.z - temp2.z;
then I replaced "17" with "leg_height"
1) I'd like to have a functional jumping code that suits the code above
2) There's a problem with this code which is going upstairs. How can I make it walk on the stairs instead of considering it as an obstacle?
ThanQ for reading