Current state:
The loop looks like this (collision with blocks seem to work reliably, collision with models definitely doesn't):
while(1)
{
vec_set(my.skill24,my.x);// for safety
vec_for_vertex(temp,my,3);//rotation mit eingbezogen
phent_getvelocity(my, mySpeed, temp);
my.temp_velocity=abs(vec_length(myspeed));
if(my.temp_velocity>2000){phent_setdamping(my, my.dampmax, 99);}
else {phent_setdamping(my, my.dampfaktor, 85);}// ACHTUNG RECHNUNG STIMMT NICHT!!!
//temp=my.temp_velocity/300;
//temp=clamp(temp,1,100);
//phent_setdamping(my,temp,min(100,temp*20));
//
if(my.bounce_on>0) {play_abprall();}
if(my.bounce_on==1)
{if(my.temp_velocity<30)//&&abs(ang(my.tilt))<5||temp<80&&abs(ang(my.roll))<5)
{
sleep(1);// um nicht in der Luft hängenzubleiben
if(my.temp_velocity<30)// still nearly still?
{
phent_enable( my, 0);
while(my.bounce_on==1){wait(1);}// bounce_on=2 only with further impact
phent_enable( my, 1);
}
}
}
//reset
my.bounce_on=0;
// safety check
phent_enable(my,0);
vec_set(temp,my.x);
trace_mode=IGNORE_ME + IGNORE_PASSABLE +use_box;
temp=trace(my.x,my.skill24);
if(temp<0){vec_set(my.x,my.skill24);}
phent_enable(my,1);
wait(1);
}
}