(NB: documentation to be continued)
The approach implemented in the following GN graph is:
1. A BezierCurve
is added in Object Mode. In Edit Mode, its control points are "hooked" to three empties, used as manipulating handles. The middle one is animated up and down.
2. In Object Mode, one Cube
is added at the world origin, then duplicated. This copy is rotated by 45 degrees around its Z axis, remaining centred at the world origin. Both cubes are gathered in a Collection. These are picked in alphabetical order. So their name is edited to control which one is instanced on oddeven indices (the first one), and which one is instanced on evenodd indices (the second one).
3. In Object Mode, one Sphere
is added at the world origin. (NB: Transformations must be "applied" to these objects, cubes (cubes and sphere,) to spawn).
4. In Object Mode, one Single Vert
is added at the world origin. The GeometryNodes modifier is attached to this object. Its Input are:
4.1. Curve: the curve on which to spawn other objects.
4.2. Last: the object to spawn at the last index.
4.3. Collection: the collection containing the objects duplicated along the curve.
4.4. Count: the number of objects to spawn, excluding the last one (labelled $n$).
4.5. Length: the distance between two successive spawned objects (labelled $\lambda$).
1. Duplicated objects are spawned by an Instance on Points
node.
2. The Selection of the points sampled along the curve to use is based on a Less Than
node comparing these points Index with $n$ (or $N$ if $n \gt N$). As Index value starts at 0, it yields that exactly $n$ points with an Index value in the range $[0,n-1]$ are selected.
3. Individual objects to spawn are picked from a user-defined collection. This behaviour is controlled by the Pick Instance check-box and by the Instance Index socket. As it is left unconnected, the point Index is used to choose which object to spawn. Because there are only two objects in the collection, the first one is used for even indices (starting at 0) while the second one is used for odd indices (starting at 1).
4. Instances are recovered from the collection using a Collection Info
node. The Separate Children socket is controlling that only one object at a time is picked, not the whole collection.
5. The Rotation vector output by the Curve to Points
node is directly connected to the Rotation input socket to align the Z axis of the spawned objectsobject with the local tangent to the curve.
1. The last object is spawned by an Instance on Points
node, its Geometry being recovered through an Object Info
node.
2. The Selection of the point along the curve to use is
such that its Index is Equal
to $n$ (or $N$ if $n \gt N$). As Index value starts at 0, it means that it is the $(n+1)^\mathrm{th}$ spawned object.
3. No Rotation is applied because it is a sphere.