1
$\begingroup$

When instancing object on a curve, the first and last objects go beyond the curve length, like in this picture:

enter image description here

If I adjust the position of the first and last point, it creates a new problem where the instances are not evenly distributed:

enter image description here

How can I fit the objects inside the limits of the curve while still preserve the even distribution of the instances?

EDIT:

The answer from @vajtus solved my problem.

I just added some nodes to his answer so this setup can be used in more situations. This way if you add any Geometry still should work.

enter image description here

enter image description here

$\endgroup$

2 Answers 2

3
$\begingroup$

In your node setup, you are just shifting the first and last point after it has been evenly distributed by the Resample Curve node, therefore it is not evenly distributed any more.

The key is to shorten the curve before you resample it but I also recommend to use the Trim Curve node instead of selecting and repositioning the endpoints. This way you don't have to worry about which way to move them.

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ And maybe use something like this to calculate the half-length automatically: i.imgur.com/NaZRJAX.png $\endgroup$
    – Kuboå
    Jan 11, 2023 at 20:42
  • $\begingroup$ Thanks. This do what I was aiming for. $\endgroup$ Jan 11, 2023 at 22:25
0
$\begingroup$

enter image description here

The Map Range Node and Attribute Statistics Node are the key nodes. The Map range is used to fit values within the desired range, while the Attribute statistics will let you know a set of values from the given field. The Min and Max values in the From sections on the Map Range Node should come from the min and max values from the attribute statistics (Remember to set it to Instances). I arrayed them in the Y-axis, so I separated the position and only edited the y values. The To Min value should be half the cube's size. This is because the cube is instanced from the center, while the goal is to start from the exact beginning. So we add the other half to accomplish the full size of the cube. Since we also want the end of the last cube to be at the exact end of the line, we simply subtract half its size from the length of the curve to do the opposite of what we did to the first cube. This becomes the To max value. I recombined the vector with edits only on the Y-Axis and used it for the Set Position Node. I hope this makes sense.

Here is the node setup:

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .