3
$\begingroup$

I've got a setup for aligning the rotation of instances to point one axis into the bends of a resampled curve, another axis is aligned with the tangent of the curve. It's working well except for the ends of the curve where there are always a couple of instances that have their faces flipped in the other direction when the curve endpoints handle type is set to automatic.

I'd like to solve this.

enter image description here

enter image description here

$\endgroup$

1 Answer 1

3
$\begingroup$

Edit - New solution flipping curves

When a curve changes side, the curve vectors are opposite and that makes the triangles flip sides.

To correct this, we need an additional unflipping method:

Unflipped solution

The flipping method:

  • For each vertex, calculates whether it's flipped or not comparing to the previous vertex (dot product negative means opposite direction vectors)
  • Whenever a triangle is flipped from the previous, we accumulate 1.
  • The odd values will then need to be flipped while the even values are ok

Unflipping nodes


Old suggestions:

For N points, indices N and -1 don't exist. You're sampling nothing at the start and end.

Alternative solution

Anything against using the curve normal? It works in a very similar way, although not exactly following the bends.

Using normals

Bend solution

You will need to treat special cases:

  • Start point
  • End point
  • Straight segments

In this example, I solve the start and end points by using "Offset point in line", which repeats the index when the end of the line is reached.

But this example doesn't treat straight segments:

Using bends

$\endgroup$
5
  • $\begingroup$ Thank you! So I don't want to use the curve normals since I want those exact bends. I'm aware that the single last points of the curve don't have another neighbor to calculate with. However, my assumption is that this problem is only affecting the two endpoints of the resampled curve and I can see that issue on those two points. The points coming just after them are aligned perfectly well, they just have their faces flipped and I'm not sure why. I can manually turn the endpoint handles, but I would be interested in an automatic way. $\endgroup$ Commented Oct 12 at 19:29
  • $\begingroup$ @Tahutify, they're flipped because the curve is to the other side, that's exactly what you would expect. If you want them all to the same side you have to create an additional rule. Such as use Z as as a preferential axis. So this problem can't be universally solved. $\endgroup$ Commented Oct 12 at 20:20
  • $\begingroup$ Interesting, then I might just introduce the original curve normals with minimum twist method into the endpoints and blur things a bit. $\endgroup$ Commented Oct 12 at 20:53
  • 1
    $\begingroup$ @Tahutify, figured out a way, see update $\endgroup$ Commented Oct 12 at 20:57
  • $\begingroup$ Wow, very nice! I'll take a look at this tomorrow. $\endgroup$ Commented Oct 12 at 21:33

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.