Learning bitmask was fun, at least I had my basics clear after reading articles and watching a video tutorial series on bitmask. In this post I’ll go through process of setting up dance moves using bitmask. Just like in the strings method, I used the data table. The same works for this method too. However, the data table in this method will only have some values instead of the key names.
I used the same “mix and match” excel sheet to make this. I listed down all the moves buttons I wanted to use. Gave each one of them a 2n value and then I did a vlookup of the buttons from the value table
Copied the data of the Moves and Values columns in a new excel sheet, saved as .csv.
Created a struct in unreal engine, with a new integer variable called “Values”. This should be the same as the row names for your values.
In the next step I created enums for all the buttons I’ll be using. You’ll notice that in this enum I have 8 entries, duplicate entries for the face buttons. This is because, if the same button is pressed twice in a 3 button move, there won’t be any way for us to identify the difference whether “A” for instance was pressed once or twice. Hence we have these buttons named as 1st val and 2nd val in the end.
After creating the enums, I wanted to store the data table values in an array to avoid the mistake I did in the “strings method”. So, I set up my data table to store it’s values on event begin play, like in the image below.
Post that I used the below setup to identify my keypress