# Problem in aligning instance to tangent of curve

I'm trying to create a procedural rollercoaster in Geometry Nodes. Usually a rollercoaster has this support in the rail:

I want it to follow the rotation of my curve, but no configuration of Align Euler to Vector seems to work. The best that I could do was like that:

The idea looks right:

But some sections of my rollercoaster are not very good, like that one:

I have a suspicion that the tangent of my curve does not correspond to the "natural" course of the tangent. Maybe I have to correct the normals of my curve somehow, but I don't know exactly if this is the problem and how to solve it.

First, instead of a mesh, I would use a classic Bezier curve for this. The fewer points you reach, the better.

At the individual curve points you can then change the tilt accordingly.

Once your curve fits reasonably well, you can move on to the Geometry Nodes.

I have modified your example a bit.

First, I added a check that not only checks if the track is on the bottom, but also if it is underneath (this can happen with curves).

I also simplified the dummy track for the raycast, so that less geometry is generated.

Then I redesigned the rails of the track so that they fit exactly to the curve tilt, just like the middle part.

This solution is better for a track because you gain full control through your Bezier curve.

Only a clean curve is necessary for this.

PS: You can also slightly reduce the individual points in a Bezier curve, or add them where you need them. The tilt values can also be smoothed out if things get a bit jagged.

• I prefered to use a mesh beacuse it looked easier to model the path. Using mirror and some stuffs of mesh editing I found it faster than starting with a standard bezier curve and adding points, carrying about the slope in every new point, etc. Am I doing something stupid or there is an easier way to build my bezier? What If I simply convert my mesh into a Bezier? It would have the same effect as building the bezier from the scratch and trying to follow the path? Jun 9, 2022 at 18:48
• @MateusRocha This is what I did here: I converted your mesh line into a Bezier curve (but did not refine it in detail). I would also approach it the other way around, start with few points, and refine where necessary. The fewer points, the better. (And if your curve has a too low resolution, just increase it in the properties). Jun 9, 2022 at 18:50
• Thanks! I rearregended the nodes and rewrote everything to make sure that I understood the ideas, and it worked out! <img src="https://blend-exchange.com/embedImage.png?bid=1dRSDWGS" /> Jun 10, 2022 at 13:49
• Now I will remake the curve and the basic modeling is done :) Jun 10, 2022 at 13:51