5
$\begingroup$

I am trying to find a way to pick a random object from a collection and join that geometry to the base mesh.

I've used instance on points before but in this case I just was to place the object where it already lives in 3D space and then join it together.

I can do this if I specify an object like so:

Manual Object

But I couldn't figure a way of taking the instances from a collection, picking a random one. If I use the collection it outputs all objects in that collection.

Any help would be fantastic!

$\endgroup$

3 Answers 3

17
$\begingroup$

you will be pretty disappointed...but here you go:

enter image description here

$\endgroup$
2
  • $\begingroup$ That works brilliantly! I've no idea how or why it works given that I thought it would spawn in random places but it doesn't. Thank you very much! $\endgroup$
    – HardCoded
    Commented Feb 22, 2022 at 19:34
  • $\begingroup$ Please click the checkmark left of my answer, if it helped you. Thanks. $\endgroup$
    – Chris
    Commented Feb 22, 2022 at 19:44
5
$\begingroup$

With the nodes improvements to the most recent Blender versions it's now possible to use fully automated, semantically clearer node trees to solve this question.

After separating the Collection into instances by checking Separate Children you can count the instances with Domain Size, always subtracting 1 to account for indexes starting at 0, then feed it into the randomizer.

Test the result against the instances indexes to select one of them.

pick random

Important: You must use a fixed ID at Random Value or it'll generate one random number for each instance. It can be set through an Integer/Value node or you can repurpose another single number. In this case I repurposed the custom Seed input.

$\endgroup$
1
$\begingroup$

But I couldn't figure a way of taking the instances from a collection, picking a random one. If I use the collection it outputs all objects in that collection.

Besides Chris's way of using a single vert to use the Pick Instances on the Instance on Points node, you could pick children objects (in a random order) straight from the collection using this set-up with Separate Geometry node. enter image description here

$\endgroup$

You must log in to answer this question.

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