This is the actual code, it almost work, I can go almost near to the bottom of the sphere, but I'm still falling.


my.pan += 8 * (key_a - key_d) * time_step; // rotate the player using the "A" and "D" keys
// vec_set (temp, my.x); // copy player's position to temp


vec_set(temp,vector(0,0,-5000));
vec_rotate(temp,my.pan);
vec_add(temp,my.x);
if(c_trace(my.x,temp,IGNORE_ME | IGNORE_PASSABLE))
{
vec_rotate(normal,vector(-my.pan,0,0));
my.tilt = -asin(normal.x);
my.roll = -asin(normal.y);
}
else
{
my.tilt += -my.tilt/5*time_step;
my.roll += -my.roll/5*time_step;
}

distance_to_ground = c_trace (my.x, temp.x, IGNORE_ME | USE_BOX);
movement_speed.x = 15 * (key_w - key_s) * time_step; // move the player using "W" and "S"
movement_speed.y = 0;
movement_speed.z = - (distance_to_ground - 17); // 17 = experimental value
movement_speed.z = maxv(-35 * time_step, movement_speed.z); // 35 = falling speed
c_move (my, movement_speed.x, nullvector, GLIDE); // move the player

Last edited by Theil; 08/25/10 21:54.