The arm needs to swing to stand 0.
I can't get it correct..
Little code to let the arm swing:
action act_arm()
{
arm = me;
set(my,PASSABLE);
var a = 0;
var power = 0;
var sw = -1;
var ang = 360/30/2;
var tor = 0.00;
var keyq;
var keya;
var keyz;
var keytab;
while(me)
{
armsnelheid = my.roll;
a += 1* power* time_step;
if(my.roll >= ang && sw == 1)
{
sw = -1;
}
if(my.roll <= -ang && sw == -1)
{
sw = 1;
}
if(key_q){
tor = 0.01;
keya = 0;
keytab = 0;
keyz = 0;
keyq = 1;
}
if(keyq == 1){
power += tor* sw; power = clamp(power,-2,2); // This let the arm swing to a height thats set.
} else { power += tor* sw; }
my.roll = a;
wait(1);
}
}
So, how to script that the arm will swing down to stand 0?
Only the line/code please. If someone can fix this?
Or does anyone know another option to script it?
Regards,
Warkey