Cinema 4D Cinema 4D Prime XPresso XPresso Nodes General
Function available in CINEMA 4D Prime, Visualize, Broadcast, Studio & BodyPaint 3D

Index Operator

Basic Parameter

Index Operator

The reason why the ObjectIndex node exists is because when you are using iterators, you cannot directly find out the index, i.e., at which part of the loop the iterator is currently located. The ObjectIndex mode allows you to find out the index, thus enabling you to, say, single out a specific element within the iteration loop.

Connect the Instance output port of the iterator to the Instance input port of the ObjectIndex node.

Example

Suppose you are using an Object List iterator with seven cubes (see example picture above). Now suppose you want to reposition all of the cubes except the third one. Well, just chuck the third cube out of the object list, you might suggest. That’s one solution, certainly. However, a more interesting way — and in some cases perhaps the only way — is to use an ObjectIndex node instead. Connect the Index output port to a Compare node and set the Compare node’s Function to != and its Input 2 to 2 (an index list starts with 0, hence 2 corresponds to the third cube).

Next, connect the Compare node’s output to the input port of the node that sets the position for the cubes (see above). Now, when the index reaches 2 during the iteration, the Compare node will switch off the position assignment and the third cube will not have its position changed.