How to make my camera follow the player vertically but not horizontally ?

Im really struggling to make this work. I want the camera to follow my player vertically but not horizontally. I have been using the 2d sidescroller template and attempted many different things but i just cant get this to work can anyone help me please ? Also im using blueprint and not C++ if that makes a difference. Any help is highly appreciated !

What have you tried so far?

I’d separate the camera from your player so they’re two separate actors. Then on Tick for the camera actor, get the World Z of your player and set your Camera actor’s World Location to 0,0, PlayerWorldZ.

iTween : Free, smooth, procedural object animation
easyCSV : Read data from any CSV and put them in an easy-to-access string map!
Runtime DataTable : Import and export game data to and from CSV or Google Sheets while your game is running!

you need to find the code that tells the camera to follow the player and either disconnect the X or multiply the transform with a 0 value for X
i’m not familiar with the 2d template but if i were to make such camera system from scratch i would use a lerp movement instead of a fixed camera.

You could use the Camera Manager to override whatever the camera is doing:

Not plug and play, you’d need to provide explicit data for the camera. But it gives you quite a bit a of control over the behaviour.

I want the camera to follow my player vertically but not horizontally.

For something a wee bit more ham-fisted yet perfectly serviceable:

One note here, if the camera is tied to the level rather than to the player, it might be better to turn the camera into a stand-alone actor to avoid issues further down the line.

1 Like

Yesss, this was perfect. Exactly what i was looking for. Thank you so much ! You have no idea how much time i spent trying to get this working !

1 Like