What I’m trying to do is to implement a small amount of logic in selecting a transform variable stored within an array.
Essentially my transform array contains four values, and the function is passed an integer. The function needs to return a different value based on the passed in value.
if (passedIn == 0) return transformArray
if (passedIn == 1) return transformArray
I’ve tried using switchOnInt but it seems to only exec functions on completion, rather than allowing me to select an array element. I’m really new to UE4, so this might be a dumb question.
Any advice or input would be greatly appreciated.
Use Get, if I have you right.
Not quite. I need to pick a different value from the array based on the input number choice. So if the input was 0, return array element 2. If it was 3 return array element 1. And so on.
There node called “Select” with yellow icon, it’s a pure node which let you reroute values of any type based on input of any type, you can change types by right clicking pin and change type, you can also add option pin by right clicking “Add Option Pin”
It sounds like you want the modulo node. (%)
So does this ‘Select’ routine just simply swap values about? I’m not entirely sure how it works.
Here are both ways. As you already mentioned, the upper one would need something after the execution. The lower one is Shadowrivers idea.
Based on the Index, it would get one of the options.
You have to feed it with an index. Which tells which option to return.
Ahh I get it, yeah, that’s what I needed. Thanks very much!
I knew this. But, it slipped my mind, and I could not remember for the life of me.
Until I found this I set up a For Each Loop and checked for my Index. Then grabbed it from the For Each Loop Node. Haha. It worked tho…