Geometry nodes - trouble aligning instances along curve

flags

Trying to get acquainted with geonodes, I’m trying to make a simple setup to quickly pop strings of party flags between objects. See attached file please! partyflags.blend (1.1 MB)

What goes right so far:

  1. draw a curve between two objects or surfaces in a collection, reduce the number of points to two so it’s a straight line between both.
  2. change curve type to bezier, drag handles on the endpoints down by an amount dependent on the curve length.
  3. convert curve to geometry to be merged with the rest at the end.
  4. also convert curve to points to distribute flags
  5. exclude first and last point from flag spawning
  6. spawn flag instances on all other points

So, that’s looking quite right so far, except for the orientation of the flags. They just don’t follow the curve tangent and all face a global axis instead of a local normal. I’ve tried replacing the resample curve node with a curve to points node, which allows me to connect a rotaton / normal socket to the rotation input socket of the instance on point node, but that doesn’t get me the right result. I’m at a loss how to tackle this (probably simple) problem. Any help would be greatly appreciated!
partyflags.blend (1.1 MB)

There are probably other ways but here is what I did:

I had to change the instances rotation in edit mode to get it to work (ie I edited the 3 flag instances orientation respect to their origins)
This also gives you a flag count input :slightly_smiling_face:

partyflagsNewVersion.blend (125.7 KB)

By the way, a tip, it is better to compress your blend file to save space on the forum, in Blenders save dialog N panel check compress, this drastically reduces file size.

Edit I changed the file and screenshot.

4 Likes

Wonderful, thank you so much! I’ll download and compare your version tomorrow.

Also, didn’t know about the compression so that’s another great tip.

I have changed the file and screenshot a bit.
With the curve to points node there is no need for the resample curve node any more so I got rid of it.

1 Like

Ah yes, I’ve pretty much tried this solution before as described in my first post, but the problem here is that I can’t get the exclusion of the endpoints to work this way.

Edit: exclusion of endpoints doesn’t work in either of your solution unfortunately. I’m thankful for your help ofcourse but still hoping for a solution where both the orientation works and the fact that there’s no flags clipping the walls where the curves attach.

Ok, I managed to get some improvement by trimming both ends off the curve before converting it to points, see first attachment (which I compressed).

Schermafbeelding 2023-01-12 171446

New solutions often cause new problems (or rather, inconveniences), which is true now as well. Behavior of the trim curve node is not exactly as I’d expect. Trim curve by factor (.15 off each side) works is many cases but the longer the curve gets, the longer the absolute trim, which makes sense. So I’d rather use trim curve by length and cut off (for instance) 30cm off each end. Which in my expectation means I inject a value of 30cm into the start socket and a subtract math node into the end socket, with length in the first and 30cm in the second socket. This gives a very unexpected result however. See second attachment.

partyflags_V2.blend (131.7 KB)
partyflags_V3.blend (130.8 KB)

image

You cand delete instances,faces,edges, points, like this from each end…

hope that helps

2 Likes

True but you are not far off use the trim curve start and end (factor mode).
partyflagsTrim.blend (127.7 KB)

Edit
Not sure what this does I think you do not need it

Sometimes we over complicate things less nodes is better if it does the job.

1 Like

Loads of ways to skin a cat! :slightly_smiling_face:
Edit
I think the trim curve idea is more simple though.

It does help because I learned something new again, so thanks! It does have an interesting side effect unexpected to me (surprise!); these index nodes work across all the splines drawn combined.

1 Like

Thanks again! Yes, apparently I was very close, yay! And you’re absolutely right about the disconnected nodes at the bottom, they’re relicts of me experimenting and forgot to delete them in the end.

1 Like