Jump to content

Rotation Flight script help.


Altier Verwood
 Share

Recommended Posts

So this is a doozy but I will try to explain it. I am working with a flight script I am trying to re write, there is a lot of junk in here that isn't important but bare with me please.

the controls are as follows OUT OF MOUSE LOOK (this part is important.)

W (brings the nose of the ship down)

S (brings the nose of the ship up)

A (rolls the ship left)

D (rolls the ship right)

E (throttle up)

C (throttle down)

Shift-A (rotates the ship left)

Shift-D(rotates the ship right)

 

But in mouse look, the controls are changed.  these commands do the same thing and i can no longer roll the ship when in mouse look.

|A (rotates the ship left)

D (rotates the ship right)

Shift-A (rotates the ship left)

Shift-D(rotates the ship right)

 

I have looked through this script many times, removed anything that talked about mouse look, but nothing worked to fix my problem, here is the full script below. any help on this would be vary appreciate,d I just want the controls to be the same in and out of mouse look.

 

 

 

Edited by Altier Verwood
Link to comment
Share on other sites

On 9/15/2021 at 2:56 PM, Altier Verwood said:

But in mouse look

a way is to use control combinations so that the vehicle controls work the same in both views. A pcode example
 

control(integer level, integer edge)
{
    // we use C and E as control keys
    // which gives us 12 control inputs in both standard and mouselook views
    //     W,A,S,D
    // C + W,A,S,D
    // E + W,A,S,D

    integer wasd;
    if (level & 1) wasd = 1;                     // W
    else if (level & 2) wasd = 2;                // S
    else if (level & 4 || level & 256) wasd = 4; // A
    else if (level & 8 || level & 512) wasd = 8; // D

    integer ctrl = 0;
    if (level & 16) ctrl = 1;       // C
    else if (level & 32) ctrl = 2;  // E

    if (ctrl == 0)
    {
        if (wasd == 1) W (brings the nose of the ship down)
        if (wasd == 2) S (brings the nose of the ship up)   
        if (wasd == 4) A (rolls the ship left)  
        if (wasd == 8) D (rolls the ship right)
    }
    else if (ctrl == 1) C
    {
        if (wasd == 1) C + W (throttle up)
        if (wasd == 2) C + S (throttle down)
        if (wasd == 4) C + A (rotates the ship left)
        if (wasd == 8) C + D (rotates the ship right)
    }
    else if (ctrl == 2) E
    {
        // these can used in conjunction with edge (key up) for one time things like
        if (wasd == 1 && edge == wasd) E + W (toggle landing lights on/off)
        if (wasd == 2 && edge == wasd) E + S (emergency stop. set the vehicle to non-physical)
        if (wasd == 4 && edge == wasd) E + A (toggle cabin lights off/off)
        if (wasd == 8 && edge == wasd) E + D (bring up a dialog menu. llDialog(...))
    }

    ...other stuff ...
}

 

Edited by Mollymews
but
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...