Camera rotation, relative to player direction

I’m working on a side-scrolling platformer and I’m having issues with the camera. There’s a lot of high-speed horizontal movement, so I want the camera to rotate around the Y-axis in the direction the player is going to show more of what’s coming up next (up to 15 degrees). Vertical rotation doesn’t really matter.

The part I’m stuck on is that I can’t map it directly to button input. There’s several upside-down-and-backwards sections where pushing right (forward) may be moving you left (still forward) so the camera still needs to focus in front of the player.

I’d post the current code, but there’s nothing relevant there right now. I feel like there’s some simple answer, but I’m still pretty new to all of this so any help would be appreciated.

Consider not worrying about Inputs or angles. Instead, capture the velocity of the player. You can do it frame to frame, or you can average it over several frames. Based on the velocity, you can project a future point of the player. You can limit that future point to some magnitude so you don’t lead the player too far. Since you only care about horizontal movement, drop the future point down to the ‘y’ level of the camera, and then Slerp() the camera to the a rotation that will center this future point. This way it won’t matter what direction the player is traveling. In addition, the camera will lead the player more when he is moving quickly and less when he is moving slowly.