Making a grind rail system for a 3D platformer game.

Hi!
After using spline tools like iTween, and trying various different ways on making a grind rail system, I’m stumped!

The objective is to make an rail object with a trigger box collider and works with a OnTriggerStay() void. The player would be able to start grinding from any point of the rail and can travel in either of the 2 directions of the rail, depending on which way the player is facing when landing on the rail. It would be cool to have curved rails, but it might be too hard to accomplish for now.

Similar examples of what I’m trying to do can be found in games like Sly Cooper (kinda), Ratchet & Clank, Jet Set Radio and Sonic Adventure.

I don’t have any code that I think would be worth improving on, so I would like to make it from scratch.

Does anyone have any ideas, suggestions, etc., they would be willing to to share with me to help me accomplish this?

Any help will be appreciated. Thanks!

It’s gonna be some combination of a controller for jumping around freely, then deciding when your foot gets close enough to a spline to start the grinding.

Then a grinding controller would move the player, and this would need to be informed of initial speed, then adjust speed over time based on whatever criteria you want, plus user inputs.

The grind controller would probably need to do some kind of “faux IK” to make the grinding player’s mass tilt convincingly in the direction of acceleration, otherwise it would look very rigid.

Finally you would pop off the rail at the end, or when the user presses Jump or whatever.

Thanks for the input! I will try my best to get this working. One of my biggest issues is handling where the player will start on the spline. When I have the player start grinding, I can normally only get the player to start at one of the ends of the spline, but never anywhere in the middle. Any idea how I could accomplish this?

Depends on your spline solution, but essentially you need to find the “alpha” term for traveling along the spline that gives the point closest to the point you want to join.

Hey Kurt-Decker,
Sorry for the late reply, I’ve spent the past few days trying to get this code to work, but I just can’t work it out :frowning:
Would it be possible to give me some pointers on what the code would look like? I’m not sure if I’m even starting off correctly.

I’ve tried using a foreach loop to find the closest node of the spline (which are Vector3’s), but I keep getting errors “converting Vector 3 to float”, etc.
Any help would be greatly appreciated!