How do I set up a invert camera checkbox inside a game menu?

Hey everyone, a bit new here.

So my aim here before I even start any sort of game ideas was to create a functioning basic menu system that can be carried from basic game to game. I have a bunch completed (thanks to the resources here and on youtube). I am currently stuck on how to properly implement a working checkbox that inverts the camera y axis when I tick it on and off. My understanding is that I need to create a boolean to set that up, I just need a bit of guidance. Thank you in advance for any help!

I’m assuming you mean inverting the look up / down. Basically you find the part in the player that does the looking and multiply it by -1.

Yes, that easy. Here’s a vid about it:

It's mostly about mouse sensitivity, but around 4:50 he talks about invert look.

Thank you for the quick response. I already know how to invert the camera, I was asking how to properly set up a checkbox that will track that in an options menu and turn it on and off for the player.

That’s a bit more involved. You need to use a save game, and save the mouse look option to the save game:

It the player chooses mouse invert, you have to write that to the save game. When the game starts again, you load that value and set it.

Thank you, I’ll try that in a little while and let you know how I make out.

Cool, come back if you get stuck :slight_smile:

I’m still stuck unfortunately, is there a way to invert the y axis without having to “save” to a game?

No, unfortunately. It’s not one of the default config variables, so doesn’t get saved to the config file. You have to save it yourself and re-load.

How are you stuck?

Well after rolling my head on the keyboard for a bit, I went back to the drawing board and figured this out. Not sure if the saving route offers advantages that I’m not aware of at the moment (Still extremely new)

I came up with this for now. I created a boolean variable on the player character and checked it on the checkbox to see if it was true or not to set it and keep it that way. (removed the image, labeled wrong)

I don’t see you multplying the axis there, but…

If it works, great :slight_smile:

If you still have problems, come back and I’ll show you a bunch of code…

I forgot to post that in haste and mislabeled a few things, here is what I have. And the checkbox works great!!..until I reload the level or level transition, then it resets to the default position of unchecked. Now I see what you mean about saving. Thank you for being patient and helping me out.

Ok, Some good news. A) I’m learning a lot about UE4 trying to figure this out haha and B) I got the setting to persist through level loads through setting up a variable in a Game instance Blueprint. I assume if I want to have it persist through shutting the game down I will have to do a similar thing with a save game? Thanks again for the responses and help.

So, save game is just like game instance except it lives in between runs.

You make a save game, call it MySaveGame ( right click in browser, blueprint, savegame ).

And you make your mouse invert look variable in the save game, just like you did with the game instance:

Notice how the default is 1. Because it’s either going to 1 or -1, as you know.

Then you need this code somewhere very early on, because if you don’t have a save game you have to make one first:

When you want to write your float value to the save game you do this:

and when you want to save it, you do this:

You might be wondering why I load the save game when I’m trying to save it? Take it from me, you need that :wink:

Tell me how you do.

I put an answer here, but it dissapeared, are you seeing it?

I’ll do it again…

So, ( yawn ), you make a save game object ( right click in the content browser, blueprint, save game ). And put your variable in it. I actually use a float to multiply the input by:

Notice the default is 1. You can use -1 when you want to invert.

So, somewhere very early on, you need to check if there is a save game. If there isn’t you make one:

When you want to read your variable:

When you want to write it:

Yes, you need to read the save game and write it back.

This is how I do the invert look:

I’m assuming that your inputs are on your player character? If so, how are you getting the invert look variable when you didn’t load it in from the save game? I’m still a bit confused. I’m just looking at the final image and still scratching my head a bit. It mostly makes sense though. I’m going to setup a save game and try it today.

Hi - yes, naturally that last shot is from my character. I’m just showing you that I always multiply by ‘invert look’.

I load that variable very early on. You could load it on begin play in the character, for instance.

EDIT: You don’t load it every time you use it, just right at the beginning. But if the user changes it, then you need to save again of course…

Ahh ok, makes a bit more sense now. I notice that you are putting “MySlot” in the slot name. Is that something I can just make up and use consistently when I read/write the save game? or does that come from somewhere else?

The slot name is just a way to have lots of different save games, you can call it what you want…

You can just follow what I’ve put here, but change the variable to your bool, if you like.

You can do it!!! :slight_smile:

I can’t thank you enough, I got everything working!! thank you for spending so much time helping me. I’m brand new to blueprints, and well all of this. I am coming from an 3d design/art background and this whole experience has helped me tremendously on the logic of how everything works together. Again, thank you!