Positioning an object on a spline relative to Player proximity

So I’m looking for a way to position an object along a spline/bezier curve at the point of the shortest distance to the player, and update smoothly each frame. Picture:

I’m doing this because I’m trying to set up some kind of player driven rail camera similar to that of God of War 3 (though less elaborate). Want the camera to follow along the rail smoothly as a player moves through the area.

I’m willing to get any asset pack that might help with this (I know a few have splines setup out of the box). Also, if there is a better way to do what I’m trying to do - I’m all ears :slight_smile:

Thanks!

I dont think there is an easy solution for finding the nearest point on a curve (bezier curve) but if your good at math you might understand this: http://hal.archives-ouvertes.fr/docs/00/20/24/57/PDF/chen_proj_07.pdf

Hah thanks! Been a while since my calc classes, but I get about half of that :slight_smile: And to think I took some classes at Zhejiang… I did a similar setup with a camera volume a while back for a scrolling beat’em-up, which is what I’m currently digging up to try and solve my problem.

I’m looking at Camera Path on the asset store as well, but I’m not sure if it can do what I want. Was just wondering if someone had already done this :slight_smile: