Ingame Invert Y Axis Option

Hello, I want to add ‘invert y axis’ option in the game for the player to change if he or she wants. Does anyone know how to do it?

Thanks in advance.

Take a look at this:

We check to see if the variable “invert Y” is true, and if it is, we then call a negate node, which is the same as multiplying by -1 to invert the axis value.

Now you just need a way to toggle the variable value, which you’ll likely want to be under an option menu. Sorry, I haven’t any experience creating menus, but you could look into that separately.

Thank you so much!

I handled it with game instance. It works now.

This is similar but seems to work just as well without having to call any extra values.

Also, here is how I called the boolean from my pause menu. Theoretically, you could call this anywhere, even from a button press.

Thank you very much for the options BP example! :smiley: That’s something I didn’t know how to do back when I first wrote this answer.

About those extra values I called: Did you mean the “Base Look Up Rate” and “Get World Delta Seconds?” For those who don’t know: Delta seconds is the previous frame render time. If the game is running at 60 frames per second, the delta time would equal 1 / 60 or 0.016667. For 30 fps, it would equal 1 / 30 or 0.0333… etc. Multiplying values by delta time keeps speed, or distance over time consistent across varying framerates. The standard method for games nowadays.

And “Base Look Up Rate” is just a multiplier for the mouse’s output value. This could be used for a simple “sensitivity” option adjustable in an options menu. If you want your game to support both a mouse, and a gamepad joystick, you’ll probably want separate variables for each.

Not completely relevant to the question about inverting axis, I know. But it’s all important to know.

Now optimizing code is something I definitely hope to improve on. I can’t really say what would be the fastest running code. ¯_(ツ)_/¯