How to achieve 2.5D movement along curve?

This is gonna be a bit hard to describe so bear with me haha. So I’m planning on making a 2.5D platformer, and the player will be controlled with your standard left and right movement, I understand that stuff.


However, many of those kinds of games also have moments where the character can walk along a curved path or something and they’re still controlled with left and right (ex. Classic Sonic in Sonic Generations, Donkey Kong Country Returns/Tropical Freeze, etc)


This video has examples of what I mean: Sonic Generations Sky Sanctuary (the platform section at 1:01, landing on the platform from 2:30 - 2:34, etc)


I guess my question is how I would do that? Not necessarily code-wise, more so just the logic behind it. If there are any existing guides about this kind of stuff, please let me know. Thank you!!

At first thought, I would probably define the whole runnable path as joined curve and line segments in the X-Z plan wherever the character is running - whether its simply left and right motion, or in and out of the screen. “Back and forwards along the curve” replaces “up and down x-axis”.

The in and out motion is not a special case, track the joined curve/line segments for planar(X-Z) motion.

Jumping is done on Y-axis as normal with physics to interact with terrain and enemies. Basically a 3D game on rails to make it 2.5D.

You need to watch out for branches if there are multiple paths or if they go above one another, but thats solvable.

There may be better ways, but this allows your path to be any shape.

ZZodo Games