3D Catmull spline intersection with a 2D plane

27 Views Asked by At

I am developing a 2D side scroller game with Unity. Since I want to have parallax background and camera zoom, maybe some other 3D effects, like shadows and such, I am Programming it in 3D. I am aware that there are libraries that handle camera movement. But I really want to be in full control of the cam movement.

My idea: The camera shall follow the player along the x axis. The z and y coordinate of the camera shall be defined by a spline.

My achievements: I was able to add fix points into 3D space, which are connected by a Catmull-Rom spline. This part was easy.

My Problem: I am not able to figure out how to map the x coordinate onto the spline to extract the y and z axis. I was thinking of defining a y-z plane which intersects with the x coordinate of the player and extracting the intersection point of the spline.

What really confuses me is how to map the x coordinate to the Catmull parameters t0-t3. Like what do the parameters actually mean in 3D space.

I also thought about Bezier splines, but they also use a parameter t.

Any help is appreciated.