Blockland Forums > Suggestions & Requests

Client-Sided Auto Pilot for Planes

Pages: << < (6/6)

Racerboy:


--- Quote from: giome298 on August 10, 2012, 03:49:32 PM ---are you guys dumb?
moveforward(0.5) is pretty much
moveforward(1); and adding walk(1);
I am pretty sure it works


--- End quote ---
Thanks for this quality info.


Can somebody do this?

BluetoothBoy:

Is it possible to get the player/vehicle's rotational values? If so, this seems like it wouldn't be too hard.

Kalphiter:

I've had this quickly-made flight indicator GUI for awhile. Not sure how it will work with this version.

--- Code: ---function axisToEuler(%axis)
{
%angleOver2 = getWord(%axis,3) * 0.5;
%angleOver2 = -%angleOver2;
%sinThetaOver2 = mSin(%angleOver2);
%cosThetaOver2 = mCos(%angleOver2);
%q0 = %cosThetaOver2;
%q1 = getWord(%axis,0) * %sinThetaOver2;
%q2 = getWord(%axis,1) * %sinThetaOver2;
%q3 = getWord(%axis,2) * %sinThetaOver2;
%q0q0 = %q0 * %q0;
%q1q2 = %q1 * %q2;
%q0q3 = %q0 * %q3;
%q1q3 = %q1 * %q3;
%q0q2 = %q0 * %q2;
%q2q2 = %q2 * %q2;
%q2q3 = %q2 * %q3;
%q0q1 = %q0 * %q1;
%q3q3 = %q3 * %q3;
%m13 = 2.0 * (%q1q3 - %q0q2);
%m21 = 2.0 * (%q1q2 - %q0q3);
%m22 = 2.0 * %q0q0 - 1.0 + 2.0 * %q2q2;
%m23 = 2.0 * (%q2q3 + %q0q1);
%m33 = 2.0 * %q0q0 - 1.0 + 2.0 * %q3q3;
return mRadToDeg(mAsin(%m23)) SPC mRadToDeg(mAtan(-%m13, %m33)) SPC mRadToDeg(mAtan(-%m21, %m22));
}
%base = 19;
%dim = 64;
%swatch = %base+%dim+%base+%dim+%base;
if(!$FlightInitiated)
{
new GUISwatchCtrl(FI_Group) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "32 32";
extent = %swatch SPC %swatch+5;
minExtent = "8 2";
visible = "0";
color = "0 0 0 20";

//Inclinator
new GuiBitmapCtrl(FI_inclinator_IMG) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = %base SPC %base;
extent = "64 64";
minExtent = "8 2";
visible = "1";
bitmap = "./circle90";
wrap = "0";
lockAspectRatio = "0";
alignLeft = "0";
overflowImage = "0";
keepCached = "0";
};

new GuiTextCtrl(FI_inclinator_M) {
profile = "BlockChatTextSize3Profile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "16 22";
minExtent = "8 2";
visible = "1";
text = "\c6.";
maxLength = "255";
};

new GuiTextCtrl(FI_inclinator_V) {
profile = "BlockChatTextSize3Profile";
horizSizing = "right";
vertSizing = "bottom";
position = "22 41";
extent = "62 22";
minExtent = "8 2";
visible = "1";
text = "";
maxLength = "255";
};

//Bank indicator (also known as roll)
new GuiBitmapCtrl(FI_bank_IMG) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = %base+%dim+%base SPC %base;
extent = "64 64";
minExtent = "8 2";
visible = "1";
bitmap = "./circle90";
wrap = "0";
lockAspectRatio = "0";
alignLeft = "0";
overflowImage = "0";
keepCached = "0";
};

new GuiTextCtrl(FI_bank_M) {
profile = "BlockChatTextSize3Profile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "16 22";
minExtent = "8 2";
visible = "1";
text = "\c6.";
maxLength = "255";
};

new GuiTextCtrl(FI_bank_V) {
profile = "BlockChatTextSize3Profile";
horizSizing = "right";
vertSizing = "bottom";
position = "109 41";
extent = "62 22";
minExtent = "8 2";
visible = "1";
text = "\c6.";
maxLength = "255";
};
};

    playGui.add(FI_Group);
    $remapDivision[$remapCount] = "Compass";
    $remapName[$remapCount] = "Toggle Flight Instruments";
    $remapCmd[$remapCount] = "FlightToggle";
    $remapCount++;
    $FlightInitiated = 1;
}

function Flight_setVisible(%val)
{
    if(%val)
    {
//672 344
//589 257
//83  87
FI_Group.position = getword(playgui.extent,0)-128-83 SPC getword(playgui.extent,1)-256-87;
FI_Group.setVisible(1);
Flight_Update();
    }

    else
    {
FI_Group.setVisible(0);
cancel($FlightUpdate);
    }
}

function Flight_Update()
{
    if(!isObject(serverConnection))
return;

    if(!isobject(serverConnection.getControlObject()) || !$Flight::Show)
    {
Flight_setVisible(0);
return;
    }
    %t = serverConnection.getControlObject().getTransform();
    %rot = axisToEuler(getWords(%t, 3, 9));

    %r = 36; //radius+4.5 of all the circles

    //
    //Inclinator
    //
    %img = FI_inclinator_IMG;
    %m = FI_inclinator_M;
    %centerX = getWord(%img.position, 0) + 63/2;
    %centerY = getWord(%img.position, 1) + 63/2;

    %deg = getWord(%rot, 0);
    FI_inclinator_V.setText(%deg);
    if(%deg < 0)
%deg = 90 + mAbs(%deg);

    else
%deg = 90 - %deg;

    %deg -= 90;
    if(%deg < 0)
%deg = 360 + %deg;

    %x = mCos(mDegToRad(%deg)) * %r + %centerX;
    %y = mSin(mDegToRad(%deg)) * %r + %centerY;
    %m.resize(%x-2, %y-14, getWord(%m.extent, 0), getWord(%m.extent, 1));

    //
    //Bank indicator
    //
    %img = FI_bank_IMG;
    %m = FI_bank_M;

    %centerX = getWord(%img.position, 0) + 63/2;
    %centerY = getWord(%img.position, 1) + 63/2;

    %deg = getWord(%rot, 1);
    FI_bank_V.setText(%deg);

    %x = mCos(mDegToRad(%deg)) * %r + %centerX;
    %y = mSin(mDegToRad(%deg)) * %r + %centerY;
    %m.resize(%x-2, %y-14, getWord(%m.extent, 0), getWord(%m.extent, 1));


    $FlightUpdate = schedule(50, 0, Flight_Update);
}

function FlightToggle(%x)
{
    if(%x)
    {
$Flight::Show = !$Flight::Show;
if($Flight::Show)
    Flight_setVisible(1);

else
    Flight_setVisible(0);
    }
}
--- End code ---


Aide33:


--- Quote from: Kalphiter on August 16, 2012, 12:10:52 AM ---I've had this quickly-made flight indicator GUI for awhile. Not sure how it will work with this version.
-snip-

--- End quote ---
Huh interesting I didn't think you could get the rotation and everything client sided which means this is possible
The mod could adjust the degrees of rotation till it's 0 and a stay there

Pages: << < (6/6)

Go to full version