Restricting camera movement to Y axis?

Hi all,

I’m working on a simple 3D side scroller, in which the character only moves left or right, no jumping. Once the character reaches the end of the current floor (level), he gets teleported to the one above (or below). Essentially I want the camera to go up or down a floor, depending on the character location, but not scroll left or right along the x axis, when the character is running around the floor.

I thought about using a separate blueprint camera actor, which gets the character location after each teleport, but it seems like a very complicated way of doing a very simple task.

I’d appreciate any help on this! Thank you.

I managed to solve my issue (using caveman logic, but still it works!). Instead of having a camera tied to the character, I created a separate blueprint class actor (camera). Since I only need the camera to follow the character along the z axis (not Y, my mistake), I multiplied the character location by another vector, with x and y set to 0 ,and z to 1. The result of this then puts the camera near the character, so by adding a vector with x and y corrected, game me the a camera which follows the character only along a z axis.