Help with making train tracks follow a path

I will let you know if I can fix the issue.

Roblox uses raycasting and gets the parts normal. This won’t work in your case as parts don’t follow the rotation properly.

@Modern_Developer2201

I think I completed it.
Indiana Jones.rbxl (66.6 KB)
Now I will not help you anymore because I am doing everything. It’s on YOU to DIY.

Do note that this will take you a pretty long time. Chances of error are low but not zero.

Alright thanks. Any help is some help right?

I’ll let you know how I go.

That’s how my method was doing it and it worked pretty good but had a few problems? I even checked the rotation with your method and compared it to a random part I dragged onto the side of that mesh and it showed correctly.

No, your method was pretty different. I used editable meshes and the objects vertices to pin-point the polar ends of the mesh and then just made a part in-between. Yours used raycasts.

That’s what I said didn’t I? That mine uses raycasts similar to how Roblox does it with their part snapping tool thing?

In the above post you didn’t but yeah.

Anyways this issue is fixed now right? If so then mark my post as the solution.

Sorry, I haven’t had time to do anything on Roblox yet, but I’ll test it now and let you know how it goes (If your method doesn’t work well for me and I find my own method I’ll mark you post as solved anyways)

Not to be a pain but… unfortunately it doesn’t work too well…

EndA and EndB still seem to be nil on some of them. I’ll let you know if i can fix any of these.
Some parts don’t work at all, some are oversized, and rotate on a weird way (Rotation is just 0, 90, 90 or something and not its actual rotation pointing up)

Hi, I’m probably just going to use my method, as its mostly accurate and I only have to manually fix very little amount of segments, unless I find a better solution.

BTW… I did change the scale property for the imported model so if thats got something to with why your method isn’t working well I can change it? Otherwise, sorry if I’ve wasted your time…

Alright so,

No I could not get your method to work and the parents model scale has changed nothing.

BUT, I have discovered why my method doesn’t work correctly. This is the raycasts visualization.

It should cast from the left of the mesh to the right and hit the side front normal of the mesh.

Image #1, IS correct but ideally would be better if the raycast lined up like shown in image #2.
Image #3, The meshes do not rotate correctly because the raycasts hit the incorrect mesh, if it were kind of like Image #2 then we’d probably be alright. The raycast should be made so it’ll cast from the left of the currently looped mesh to the right and hit the currently looped mesh.

I’m not really good with CFrames so not really sure what I’m doing but yeah this is what the problem is with my method.

I’ll give you the placefile now just and case you wanna look at it because I’m going to bed now so I wouldn’t be able to give it to you for like 20+ hours if you did want it.
Track Layer V2.rbxl (214.3 KB)

Hi,

I can’t really work on this properly right now because my mouse decides it doesn’t want to work properly… anyways, do you think if I used a combo of my method and your method I could acheive a correct thing?

My method works fine for most meshes because most parts the raycast actually hits that front face like its supposed to, and the problem parts the raycast actually hits the end normals which I think is because of where I set my origin, and to me it seems nearly impossible to get it to be pararell with the meshes front normal without its real or a close enough orientation.

So my idea was to use editable mesh, get that front face and get the center point of it and then do kind of look vector method? The look vector method doesn’t work properly using the meshes CFrame…

I did have another idea which was to use my method as is but then perform a second raycast but this time change the origin to use the look vector or something on the new parts, delete these new parts then rerun the code again using the parts more approximate orientation but still hit the mesh.

The first few times of me reading your code I couldn’t really understand it (probably because idk how to use editable mesh or editable images) but now reading it again I’m kind of getting it. So I might be able to do some kind of magic using a combo of stuff.