how can I lock the camera to the X axis Without even tick

Working on a 2.5D side-scroller with a 3D character and I am trying to figure out how to make it so that the camera doesn’t keep bouncing up and down when I jump or go onto slightly higher platforms…Unless I get past a certain spot on screen or enter a specific volume in which case the camera can pan up slightly. Similar to Donkey Kong Country: Tropical Freeze

around 11:35

I would prefer doing this without an event tick, is it possible to do so?