Quote:
Originally Posted by fowlplay4
This was posted way back when in the Classic iPhone thread.
PHP Code:
xaxis = -(getangle(getAcceleratorAxis(0), getAcceleratorAxis(1)) - pi); // stays at pi/2 yaxis = getAcceleratorAxis(2); // stays at 0
Doesn't work.
|
I made this on Classic iPhone Dev
PHP Code:
//#CLIENTSIDE
function onCreated() {
enableAccelerator(true);
createProfile();
this.running = true;
new GuiProgressCtrl("x_progress") {
profile = axisprofile;
useownprofile = true;
resize(50, 15, 200, 25);
progress = .5;
}
new GuiProgressCtrl("y_progress") {
profile = axisprofile;
useownprofile = true;
resize(50, 35, 200, 25);
progress = .5;
}
new GuiProgressCtrl("z_progress") {
profile = axisprofile;
useownprofile = true;
resize(50, 55, 200, 25);
progress = .5;
}
setTimer(0.05);
}
function onPlayerChats() {
if (player.chat == ":toggleaxis") {
this.running = !this.running;
if (this.running) {
enableAccelerator(true);
if (timeout <= 0)
setTimer(0.1);
}
else {
enableAccelerator(false);
setTimer(0);
}
}
}
function onTimeout() {
temp.xaxis = (roundto(getAcceleratorAxis(0), 0.05))/2;
temp.yaxis = (roundto(getAcceleratorAxis(1), 0.05))/2;
temp.zaxis = (roundto(getAcceleratorAxis(2), 0.05))/2;
x_progress.progress = temp.xaxis+.5;
y_progress.progress = temp.yaxis+.5;
z_progress.progress = temp.zaxis+.5;
setTimer(0.25);
}
function roundto(val, dec)
return int(val/dec + 0.5) * dec;
function createProfile() {
new GuiProgressProfile("axisprofile") {
this.copyfrom("GuiBlueProgressProfile");
bordercolor={0,0,0};
bordercolorhl={0,0,0};
bordercolorna={0,0,0};
fillcolor={255,0,0};
fillcolorhl={255,0,0};
fillcolorna={255,0,0};
}
}
I found each axis has a value between -1 and 1. The bars make it quite easy to follow