4
$\begingroup$

I'm trying to place objects in a grid pattern but I don't want a regular grid where I set column and row count. Instead of column and row I want to set the column and object count and if the count of objects is greater than the columns then it should automatically create a new row. Like in the picture there is a column count of 4 and object count of 9 when objects are greater than 4 it should place objects on a new row and when greater than 8 place on a new row and this should go on indefinitely. I believe it's possible to make something like this with the Grid geometry node but I don't know how. Maybe if I create a grid and make it 4 columns x 1000 rows and then only fill some of the grid cells based on the object count.

.

$\endgroup$
1
  • $\begingroup$ If your question was solved, please be so kind and mark the answer that contributed to the solution as "Accepted Answer". This will make it easier for others to see which way leads to the solution, and the question will no longer appear as unsolved. Thank you! Here you can find more information: What should I do when someone answers my question?. If you still didn't get a solution to your question, please be kind enough to address it. $\endgroup$ Aug 27 at 23:22

2 Answers 2

4
$\begingroup$

Here's a Geometry Nodes setup you can use where you have the Number of Objects and the Number of Columns you can adjust.

enter image description here

$\endgroup$
3
$\begingroup$

Divide the number of your objects by the number of columns.

Round this value up, then you get the number of rows.

The size of the grid results from the number of columns, rows and the given width of an object.

After you have created your grid, use the node Instance on Points.

However, pass a selection that contains the number of objects as the highest index.

enter image description here

Sorry, it didn't occur to me until after I made this post that it's actually largely identical to @HarryMcKenzie's.


Update

Here's another technique I came up with to go along with it:

enter image description here

Instead of using a grid as a base here, I just duplicate the given object and move its position with a little logic.


(Blender 3.2)

$\endgroup$
5
  • $\begingroup$ Hey no problem! your solution is definitely better because it uses lesser nodes! You're the geo nodes expert :D $\endgroup$ Aug 17 at 9:01
  • 1
    $\begingroup$ @HarryMcKenzie Thank you for your praise, I really appreciate it coming from you ;-) $\endgroup$ Aug 17 at 9:05
  • $\begingroup$ <3 btw I was surprised that you're able to directly use index. in my case the index was not as ordered as in your case that's why I needed to position the instances with some additional math. what is going on XD $\endgroup$ Aug 17 at 9:11
  • 1
    $\begingroup$ @HarryMcKenzie This is because you created your grid in the other direction. The indices of a grid always run along the Y-axis first (That's why I rotate the whole grid again by $90°$ at the end). $\endgroup$ Aug 17 at 9:22
  • $\begingroup$ aaahhhh cool thank you! $\endgroup$ Aug 17 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.