How do I use a loop to add value to a variable with nodes?

I want to populate an array with numbers and use these to spawn objects at different locations.
But I’m stuck at expressing “variable ++” via nodes. I used a vector math node to add 1.5 but instead of adding to the previous value it keeps adding 1.5 to 0.

Here is the .blend:Mouse Spawn via invTargets array.blend (658.1 KB)

Picture:

The math node doesn’t change the variable on its input side, it only does the set operation with them and outputs the result. To change a variables value you need to use the “Set Variable” node. This will be variable++.

2 Likes

I can’t seem to find a “set vector” node. Or does “Set Variable” also work with vectors?

edit: Yes “set variable” also works with vectors.

1 Like