ok, i've had some time, tested this under A6.40, but seems to work...
here's the code i use:
Code:
entity* car;
//Environment Defines
var earth_gravity[3] = 0,0, -887;
action physics_ent
{
car = me;
phent_settype(my, PH_RIGID, PH_BOX);
ph_setgravity( earth_gravity );
phent_setmass(my, 7, PH_BOX);
phent_setfriction(my,20);
phent_setelasticity(my, 25, 1);
phent_setdamping(my, 30, 15);
control();
}
function control
{
var velocity;
var velocity3[3];
while(1)
{
phent_getvelocity(my, velocity3, nullvector);
velocity = vec_length(velocity3);
if(key_w == 1){vec_set(temp.x, my); vec_normalize(temp, 5000); phent_addforcelocal(my, temp, nullvector);}
if(key_s == 1){vec_set(temp.x, my); vec_normalize(temp, -2500); phent_addforcelocal(my, temp, nullvector);}
if(key_a == 1 && velocity > 60){phent_addtorqueglobal (my, vector(0, 0, 200));}
if(key_d == 1 && velocity > 60){phent_addtorqueglobal (my, vector(0, 0, -200));}
wait(1);
}
}
function main
{
video_switch(7, 32, 2);
fps_max = 60;
level_load("nascar_test.wmb");
wait(5);
}
should work.
regards,