# (Geometry Nodes) Sample curve tangent with multiple splines

https://youtu.be/OXGD1KlSuZo

Aligning instances to a curve is great, UNTIL a second curve/spline is added. In which case it instantly goes to hell. As much as I've searched, I can't seem to solve this (elementary) issue.

As it's fundamental to following input curves I know I must be doing something wrong? but I can't figure it out despite plentiful googling. What am I missing here, or is it a bug ?

The problem with your setup is that the Sample Curve node's output is based on the complete curve, which means the Factor or Length are accumulated to the total length of all curves, if you have multiple curves in your geometry.

For example, let's say your geometry holds two curves: the first has a length of 4 meters, the second a length of 6 meters. This means for the Spline Parameter node:

• The first curve has a length of 0 meters and a factor of 0 at its starting point and a length of 4 meters and a factor of 1 at its end point.
• The second curve has 0 meters and factor 0 at the start and 6 meters and factor 1 at the end.

If you now use a Sample Curve node this accumulates all curves to treat them as one curve which results in the following values:

• The overall curve has a length of 10 meters, with factor 0 at the start of the first curve and factor 1 at the end of the last curve.
• The first curve now starts at 0 meters and factor 0, ends on 4 meters and factor 0.4.
• The second curve starts at 4 meters with factor 0.4 and ends with 10 meters at factor 1.

This was just for explaining the problem. The solution is quite simple: instead of using the Sample Curve node you can use the Tangent node and plug it directly into the Align Euler to Vector node. What I only would recommend is to increase the Resolution Preview U value in the Curve Properties to get a smoother alignment. And maybe, sometimes if the curve is a little bit twisted, it helps setting Twist Method to Z-Up instead of the default Minimum. But this also depends on which axis you choose to align to etc. • Oh my goodness, THAT is the answer. Apparently I don't have enough reputation here to upvote your answer, but you get massive appreciation. Thank you so very much. :) May 25 at 7:03
• @RicoHolmes You're welcome, at first glance I didn't know what was wrong either until I remembered what the Sample Curve node does... May 25 at 7:32
• Phrased much better than I was about to .. :) I'm still trying to reverse-engineer this difference in behaviour between 2 methods of alignment May 25 at 9:39
• @RobinBetts Not sure if I understand what you mean with different methods of alignment... Align Euler to Vector is calculating the Euler rotation to align to a certain vector. Curve vertices are not rotated (apart from a tilt maybe). After converting with Curve to Points, the generated points are already rotated aligned to the curve, which is why you can use their Rotation directly to align instances. The original curve's tangent and normal get lost, but the Curve to Points node generates these vectors based on the points. These could also be used with Align Euler to Vector. May 25 at 11:36
• @Gordon ..zackerly. I would have thought the results should be the same? But the endpoints and penultimate points are rotated differently with the 2 methods.. some difference in interpolation... May 25 at 11:42