Limiting character position to X- and Y-axis only

Hi! I’m relatively new to UE4 and have just started playing around to get a feel for the interface. I created a sidescroller map where movement is limited to the X- and Y-axis, and it works totally fine until I approach a diagonal object, like a rock in this case. The character moves “along” the object and therefore along the Z-axis, which I don’t want it to. Is there any way to not only limit movement, but also the character position?

Added a link to a GIF of my problem.

Thanks in advance! :smiley:

Does your character/pawn have a CharacterMovement component? How are you adding movement to the character?

Yes it does, it’s the default CharacterMovement taken straight from the Sidescroller preset. The “Walkable floor Z” value is set to 0.71 which according to UE is “non-walkable”, is there any way I can fix this in the CharacterMovementComponent header file inside VS?

Just checking, but do you have the planar movement section set up correctly?CharacterMovement.png

From the look of your gif, you actually want to restrict movement along the X axis, not the Z (Z is up/down, so jumping, X in your setup is in/out of the screen, where he’s running along the rock). Setting the character to move along a Z/Y plane should stop him sliding along the rock like that hopefully.

1 Like