I have been trying a gravity function for a player using c_move and the script from the workshop 24. But i did not have any success. Can some one help me ?(I dont want any physics related options for now.)

int height;
action func_player()
{
//set(my,INVISIBLE);
int x_speed;
VECTOR vfeet;
int angle , fall;
vec_for_min(vfeet,me);

while(1)
{

x_speed = 3 ;
fall -= 2;
c_move(my,vector(x_speed * time_step * (key_cuu - key_cud),0,0.5*sin(angle) * (key_cuu - key_cud)*time_step +(0.5*sin(angle)*key_shift * time_step)),nullvector,GLIDE);
camera.x = my.x;
camera.y = my.y;
camera.z = my.z;

camera.pan = my.pan ;
my.pan += (key_cul - key_cur) * 8 * time_step;
c_trace(my.x,vector(my.x,my.y,my.z - 1000),IGNORE_PASSABLE | IGNORE_ME);
if(my.z >= (hit.z - vfeet.z))
{

c_move(me,vector(0,0, fall * time_step),nullvector,GLIDE);
}
else
{
my.z = hit.z - vfeet.z;


}
angle += 10;
wait(1);
}
}

My idea is not really good as c_move puts the player down but the my.z line puts the player up.



Last edited by Mithun_Mohan; 01/27/13 15:52.