as far as I know, void functions do not return values. However, when I run the code below,
the wind vector gets smaller and smaller with each frame, because the va value is returned back as new wind vector.
Why is that?
I would expect that wind stays the same all the time and just serves as input for the function.
I am actually working with Code of Nature right now but must have overlooked the section 2.4., where he explains that this would happen and how to avoid it.
This is not about the sub function but about the apply function in the code above. It is called with wind as input parameter but I did not expect that would change the value of wind, because apply is a void function.
you passed an object as a parameter and apply() modifies that object’s data so when you come back, even if apply() did not return anything, you have all the side effects.