I don’t know if the code has errors or not, but there is something you need to know about it. So you’re using a 2D Axis Input Action (Vector2D), here’s how it works:
- X = right/left (A/D)
- Y = forward/backward (W/S)
The confusion comes from 2D input vs. 3D world directions.
In input, pressing W gives you (0, 1), meaning “go forward” on the Y axis.
But in the 3D world, forward movement is along the character’s X axis (GetForwardVector).
So we have to “Swizzle” or convert the input Y into movement along the X direction.
That’s why we only apply Swizzle for W/S. (forward vector)
For A/D (left/right), the input 2daxis X already matches the 3D right/left direction, so no swizzle is needed for A/D. (right vector).