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.
I guess my question was directed more toward the people who wrote the original code. Why did they decide to use the entirely unintuitive term “swizzle” instead of something more clear?
Also, replying to someone’s question with a chat gpt answer is just… pretty audacious. It upsets me in the same way naming the second axis value “swizzle” upsets me
It seems to be an extraction of information from the wikipedia definition of Swizzling (computer graphics). ChatGPT just scrapped the website for information.
Swizzle is a know operation in vector math.
Epic is made up of programmers and for the most part make their engine for programmers. Don’t be surprised if they use technical language in the engine.
You could use “swap axis” but I’m guessing they are just used to the technical term for remap vector.
Just check the engine code. It’s peppered with thousands of swizzle commands for all types of vectors.