It would be better if you posted the code text on the forum, not screenshots. Screenshots are hard to read, and can't be searched, or copied pasted. You can post code by typing 3 tildes ~~~ on a line by themselves directly above and directly below the code text.
To answer you question, you are setting direction equal to zero on the first line of process, so if no keys are pressed, you will have (0, 0, 0) for the rotation. You likely want to move the "var direction ..." line to the top under velocity and then change the inputs to use absolute instead of relative when adding 1. I would edit the code for you, but I can't, since you posted images rather than text.