How would I go about adding rail grinding?

Hello! I’m working on a platformer/rpg thing and I’m almost started on the 2nd level. However, the 2nd level has more of a focus on rail grinding due to it taking place underground.

Does anyone know how I’d be able to implement something like that? What are some possible solutions (like would I use raycasts or bodyvelocity or a mixture of both?) I’d prefer a solution that would let me build the rail like, manually cuz I like seeing where things are. :v

Any help will be greatly appreciated, and kudos in advance!

Oh and some extra context just in case someone doesn’t know, but when i say rail grinding I mean something like this
grind-rails-3d-platformer

Maybe try looking for posts about moving an object (train or car) along a path or rail.
I would think just off the top of my head, using a render stepped, and setting the characters cframe along a path of predefined points (the rail) with appropriate animation and speed.

2 Likes

Could be a good start, I’ll look into it

I could not find anything ;-;
Do you have anything in mind?

As I said, I would think you could do a render stepped loop

and having the player’s Character’s PrimaryPart (HumanoidRootPart) Anchored = true
You then CFrame the Character (with PivotTo) along a path of points that follow a rail at a set speed.

what about letting the player jump off though? :thinking:

Its just a formula for a ‘jump arc’ should be a way to calculate the arc and just have the character follow that for the jump

Personally, I would use the AlignPosition constraint for a system like this for a more physics based approach

2 Likes

i’m not entirely sure what you mean by that, do you mean like make the jump so that it always follows the same height? If so, then I think it’d might make it a little difficult to have a bit of creative freedom in terms of where you can jump, unless I’m thinking about it completely wrong

that does seem interesting! i’ll see what i can do with that in a bit :thinking:

How would you go about this btw, from what I’ve gathered you would need to physically place an attachment on both subjects :thinking:

You can use raycast to determine the position of the alignPosition that the character needs to be at during the rail grinding.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.