How to change axis of character movement?

I am using the sidescrollercharacter in the sidescroller template and instead of moving left and right, which will be West and East if you imagine a compass with north pointed up, I want him to be able to move North and South when he enters a hallway (up and down not left and right.) So, I have it set up with a bool that he is on the floor and not hallway but when he enters the hallway, hallway is checked and floor unchecked (floor is left and right, hallway is up and down.) I set up a trigger on Floor and Hallway and on BeginOverlap they set true Hallway or Floor and set false the other. In the character blueprint, it checks whether Floor is true or false. If it’s true then he walks normally, left and right, and if false, he moves up and down. But, he always moves left and right even if he;s in the hallway. That’s the problem. his body is faced up and down when I press A and D but he moves left and right.

Floor BP:

Hallway BP:

Change Axis Movement depending on if character is at Floor or Hallway:

Character starts at Floor and moves right, past the first real door, and to the glass “door” and goes into Hallway which is the path in the middle. He moves to the other side of the glass door right in the center of it:

Then I try to move forward, but Player moved right instead when I pressed ‘D’ (this is based on before the camera rotated, based on the original camera.) Basically, I want the player to move along in the hallway to the wall instead of moving on the wrong axis:

It’s a little confusing to explain in pictures but I don’t know how to make a video of the gameplay yet (I never used matinee before)

I see you’re setting the local floor and hallway variables in the blueprints but where are you setting the floor variable in sideScroller character blueprint? That’s the only one that matters. The variables aren’t global, they only apply in the blueprint they’re in. That means you have to change the variable in the sideScrollerCharater blueprint.
Get rid of your variables in the hallway and floor blueprints and simply call your character and set the floor variable directly. Like this.
The floor BP with the trigger

The character BP

82333-characterbp.png

Don’t change the Movement Input directions if you are also rotating the character in the direction you want to face, doing that will essentially keep him moving only left and right. If he is facing East adding movement in the X Pos or Neg will make him move left or right on the screen or East/West, if you rotate the character to face North and Don’t change his input direction he will still move on HIS X axis which will now be North and South in the world because he has turned in the world to a new direction but his own direction for movement doesn’t also need to change since he is always facing down X in his own space in the character BP. Get it? Pointing him in the right direction is key not changing his input vector direction. He will always move along the X axis when he walks forward, X is his forward vector.

I followed exactly what you said and it didn’t change anything. Still moves sideways instead of forward.

I disconnected the player rotate nodes and moved the ‘W’ event but now the player doesn’t move through the glass door like I want him to.

But I’ll keep messing around with what you said, in case I did it wrong or didn’t understand what you meant

Yeah, even if I only rotate the camera and leave the input axis alone and don’t rotate the player, the player still only moves sideways. But, if I only rotate the camera and don’t rotate the player, and change the input movement to -1 in the x and change y to 0, then the player faces forward and backwards but doesn’t move a single step. He is essentially just rotating his body.

Is the player pawn set to use control rotation? Try setting the character to use controller yaw. When the character is rotated and movement is added to the X axis regardless of which way he is facing in the world he should be walking forward in the direction he is facing because X is the forward vector. Which is why I said if you rotate him in the direction you want him to walk adding movement input on the X should make him move in that direction.

Okay so when I rotate the player to face forward instead of the side, then the camera rotates, and I checked character to use controller yaw, he twitches left and right, maybe about 45 degrees or so but remains in place.

Standing still, not pressing A or D:

Trying to move:

OK this is getting long winded, sorry, would you mind sharing your project file so I can take a closer look at what all is going on?

Umm…how would I do that exactly? I copy the whole project or just config and content? As you can see, I’m very new to this software :stuck_out_tongue:

the config, content and .uproject file are needed just copy them into a folder and zip it, you can use dropbox or google drive and you can set permissions so no one else can download it without your permission if you are more comfortable with it like that. I am only asking to look at it so we can get this working for you in a more timely manner instead of this slow back and forth

Thank you very much for explaining everything!

No problem, downloading now.

Cool, if you need help understanding why I did something, just let me know

Sent you a PM.

Uploading the project now.

All setup and ready to go created a movement switching BP as an adjusted extension to your EnterHallwayBP that calls a function on the player to run the movement switching, added some useful debug info to the playerBP & the HallwayBP and the movement is fixed, the constrain to plane was one of the reasons it wouldn’t shift movement directions. Everything that is working correctly is now in the “Adjusted” folder and that should give you a really good starting point to expand upon to create the gameplay elements you are trying to achieve. There are more notes through the other BPs as well Let me know if you need help with anything else.

project files:

I really appreciate you going above and beyond for me and for going out of your way to fix some other stuff that I’m sure I did the wrong way or was not correctly optimized :slight_smile: I don’t know if you would actually want me to ask you any other questions in the future because I’m just starting out and I have a lot haha (although I do try to find the answer before I ask.)