var jump_height = 80;
var jump_target;
var nc_gravity = 2;
var playermovementz;
var move;
function NC_Movement_Ctrl()
{
while(1)
{
//my.Above_Ground=c_trace(vector(my.x,my.y,my.z - Z_Offset),vector(my.x,my.y,my.z-5000),IGNORE_ME|IGNORE_PASSABLE|USE_BOX);
my.Above_Ground=c_trace(my.x,vector(my.x,my.y,my.z-10000),USE_BOX|IGNORE_PASSABLE|IGNORE_ME);
my.Above_Ground=clamp(my.Above_Ground,0,100);
if(my.Above_Ground > 5)
{
accelerate(playermovementz,-nc_gravity*time_step,0.1);
}
else
{
playermovementz=-(my.Above_Ground/1.2)+2;
if((my.Above_Ground + playermovementz) > 5){playermovementz = - my.Above_Ground - 5;}
if(key_space == 1){jump_target = jump_height;}
}
if(jump_target > 5)
{
playermovementz = ( sqrt((jump_target)*nc_gravity) ) * time_step;
jump_target -= playermovementz;
c_move(my,vector(PlayerMoveSpeed*time_step*move,0,playermovementz),nullvector, USE_AABB | IGNORE_PASSABLE | GLIDE);
}
wait(1);
}
}