I am making a 2.5-D sidescrolling auto-runner with wall jump and ledge grab/wall climb mechanics. I have an “Add Movement Input” node on the event tick that sets World Direction to (1,0,0) when the player is not in the air. Doing a wall jump rotates the character 180 degrees about the z-axis, so when jumping off the right-side wall the forward vector becomes (-1,0,0). This worked fine until I started doing line traces vertically to check the top of walls for the ledge grab and realized that the player can only grab walls on the right side. I figured out that the forward vector was being set to (1,0,0) immediately upon touching the left wall, and therefore was causing the line trace to fall short on the left side of the character. Initially, I thought this was because of the collision with the wall, however while debugging, I made the movement function only call while a key is held down. In doing this, I found that upon releasing the key immediately after the wall jump, the forward vector changes back to +1, so it seems to be based on whether the “Add Movement Input” node is being called. Does the forward vector default to 1 if nothing is happening? My intuition says the character should stay facing the same direction until “Add Movement Input” is called again.
I also tried using a variable that stores the player’s last velocity while in the air and having the movement function check this variable only when the player is in the air, and add a movement input in the same direction (i.e. if the x value of the player’s last air velocity is < 0, the event tick should apply “Add movement input” of (-1,0,0) until the player lands, at which point it’d switch back to (1,0,0). This doesn’t feel like it should be necessary but figured I’d try it as a workaround until I could find something better, but not even this works.
I think I must have a fundamental misunderstanding either of how the forward vector works (my understanding is that each component of a vector is essentially the % movement in each direction, and therefore also tells the direction the character is facing), or how I should be moving the character (is “Add Movement Input” intended only when the player is directly controlling the character? Should I be using a different node for automatic movement?).
Any help is appreciated, thanks in advance.