How do I make a transforming jet control system?

I have planned to create a shooter/dogfighting game on the unity engine, I have all the scripts I need for combat (Rockets, Bulltets, Health ETC.) but I have had a heck of a lot of trouble trying to create a control script. My character needs to be able to switch between two control scripts, the first script being a “jet” script where the player is flying forward at a high speed using W & S to change speed (3 Speeds), A & D to yaw left/right, Shift to use an afterburner (for 10 seconds max) and the arrow keys to ascend/descend/roll. Then when the player presses a certain key (F?) the ship transforms and comes to a hover. The player then uses the arrow keys to hover in directions, space to ascend and Ctrl to descend. The player can change between these controls at any time?
I know this is a HUGE ask but I am absolutely horrible with programming custom controls.
If anyone could help it would be GREATLY appreciated :smiley:

Here is a diagram to help:
19315-example.png

“Man, look at dem ms paint skiels”.

Another example:

-Like this without the robot mode, see 2:20.

1 Answer

1

It’s pretty simple…

var hoverMode : boolean;

function Update () {
if (Input.GetKeyDown (KeyCode.F) ) { 
    hoverMode = !hoverMode; 
    }
if (hoverMode) {
    if (Input.GetWhatever...)  {
         DoSomething();
         }
} else {
    if (Input.GetWhatever...) {
         DoSomethingElse();
         }
    }
}

No, I’m not writing your whole control script for you; but there’s the gist of it.

Was that not the part of the script that you were having problems with?