Author Topic: Client-Sided Auto Pilot for Planes  (Read 2204 times)


Bump once more, this is definately needed.


so
just keeping the speed the same?

If only there were instruments for planes on blockland, where you can adjust the trim on the planes, and the things would practically fly themselves... I'd rather have that than auto pilot, because adjusting the trim requires effort to get it perfect, and you still have to watch the plane.

so
just keeping the speed the same?
The same speed that you were going when you activated it.

And the same relative direction.

And stabilize the plane (put it in the up-right position...parallel to the ground)

I thought I explained all of this in the OP.

what would change the direction though?
and the person could put it upright to start with

what would change the direction though?
and the person could put it upright to start with
If the plane is just going a little bit down or a little bit up...then it'll just keep escalating. I don't mean the plane's rotation, I mean its direction up or down. It should be flying parallel to the ground in auto-pilot.

are you guys dumb?
moveforward(0.5) is pretty much
moveforward(1); and adding walk(1);
I am pretty sure it works

are you guys dumb?
moveforward(0.5) is pretty much
moveforward(1); and adding walk(1);
I am pretty sure it works

You're a whole page late

are you guys dumb?
moveforward(0.5) is pretty much
moveforward(1); and adding walk(1);
I am pretty sure it works

Thanks for this quality info.



Can somebody do this?

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

I've had this quickly-made flight indicator GUI for awhile. Not sure how it will work with this version.
Code: [Select]
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);
    }
}

I've had this quickly-made flight indicator GUI for awhile. Not sure how it will work with this version.
-snip-
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