Posted By: tzw
maybe a problem about gravity? not sure... - 06/12/11 10:07
hi everybody, i am working on a standard ACT game.
but i got some problems on the chara's moving,
when the player Glides along the ground especially a terrain ,
the player "shakes" up and down quickly.
i guess the resaon is my gravity codes,but not sure
my gravity code :
i invoke this function per frame in the player's action.
thanx in advance.~~~~
and the map which i use is from the rpg template.
but i got some problems on the chara's moving,
when the player Glides along the ground especially a terrain ,
the player "shakes" up and down quickly.
i guess the resaon is my gravity codes,but not sure
my gravity code :
Code:
function gravity_handle() { static var fall_speed=0; VECTOR temp3; var current_height=0; vec_set(temp3.x, my.x); temp3.z -= 1000; if( c_trace(my.x, temp3.x, IGNORE_PASSABLE )>0) { current_height =my.z-player_body_height- target.z; } if(current_height <1*0.8) { fall_speed= 4*time_step; } else { if(current_height >= 1 ) { fall_speed -=15*time_step; } else { fall_speed =0; // } } c_move(me,NULL,vector(0,0,fall_speed),IGNORE_PASSABLE); }
i invoke this function per frame in the player's action.
thanx in advance.~~~~
and the map which i use is from the rpg template.