Learning the new input system I dont understand when I should use Swizzle, I know that it flip axis but when I should use it ?
Thanks
Learning the new input system I dont understand when I should use Swizzle, I know that it flip axis but when I should use it ?
Thanks
When you want to flip the axis of input, like WASD keys.
The first person example swizzles the WS (up/down) axes, but not the SD (left/right) axes, for example.
In the example, the input is essentially passed to the Move Action as a 2DVector like (x, y). If you were to ignore swizzle, you’d be sending the value of WS as the first/x axis, like (WS, 0), which would be problematic when you have to deal with AD’s input in the form of (AD, 0), too.
With it, you’re sending the values of the y-axis (WS) as (0, y), which, together with the values of the x-axis (AD), becomes (x, y).
This may be a dumb question, but why is the modifier called swizzle?? Why not just “y-axis” or “second component”?
From what I managed to get from ChatGPT it means exactly what you asked, and here’s a possible explanation:
The term “swizzle” in computer graphics and programming generally refers to a rearrangement or reordering of components within a vector or data structure. Here are a few reasons why the modifier might be called “swizzle” in the context of Unreal Engine or similar frameworks:
Intuitive Operation: “Swizzling” implies a straightforward operation where you rearrange the elements of a vector to fit a specific pattern or requirement. In the case of Unreal Engine’s input system, applying a swizzle modifier ensures that the input from a particular key or button is directed to the correct axis or component of the input vector.