bCameraSpot = !bCameraSpot;
Assign negated state of varable in to varable ,so false become true and true become false, creating flipflop behavior of bollean
bCameraSpot = !bCameraSpot;
Assign negated state of varable in to varable ,so false become true and true become false, creating flipflop behavior of bollean
Hello,
I’m very new to programmin so you will have to forgive my newbish question.
How can i replicate the blueprint flow control node “Flip Flop” in c++ ?
I’m trying to change my camera relative location when ever i press T and i only need to switch a bool value, but how can i do that??
Right now i’m stuck with this:
Character.h : character.h - Pastebin.com
Character.cpp : character - Pastebin.com
Thank you very much, that did exactly what i needed
Hi Bio90,
It sounds like Shadowriver’s solution will work for what you need. However, since you mention you are new to programming I want to give you a small warning. Using the line of code mentioned above does not have any built in “sanity check”. You will want to make sure that the value that you are sending into that line is what you think it is. If you don’t, it is possible to run into situations where you expect to get a true
value out of the code, but the value you sent in was true
so you end up with false
. You most likely won’t have any problems with a simple project, but as it gets more complex the chances of unexpected behavior increases. It is better to plan for it now so it doesn’t surprise you later.