We saw that with Input.get_vector, we can get a direction vector.
Let's look at what the function outputs for us.
This little demo shows the output of the function.
If we don't press anything, we get a vector of length zero.
Now, if I press up, I get a vector pointing up.
If I press D, it points to the right, and with W and D it points to the top right.
Now the important part here is how you can see
the length of the vector is always the same.
To be precise, it's limited to one.
This makes it so whether we're trying to move vertically,
horizontally or diagonally,
the ship or whatever you are moving will move at a consistent speed.
This is the purpose of a direction vector.
Now, when you don't have any input, the vector has a length of zero.
And the math with that works similar to what you learned at school.
Zero times anything is equal to zero.
A vector two of length zero, times anything is a vector two of length zero.
As a result, the character will have no velocity and not move.
Or the ship in our case.
I want to show you another thing.
This function gives us support for analog input.
You can see the gamepad in the top right.
Notice how when I move the joystick, the vector changes direction and length,
and this time it can be a bit shorter than before.
Analog input is just that.
It's the ability to control the length of our direction vector
to make the ship move faster or slower.
And Input.get_vector will take care of that for you.
So you can get both keyboard input support
like this, or you can get gamepad input support.