I’m trying to create a function where, if there is a value increase in a set of data, then add the difference to a stored value . This is what I got so far, but it throws an error:
import c4d
op[12345] = 0
def main():
global Output1, Output2
if Input1 > Input2:
Output1 = Input1 - Input2
else:
Output1 = 0
op[12345] = op[12345] + Output1
Output2 = op[12345]
If I do something like op[12345] = op[12345] + 1 it will iteratively add a value of 1 after each frame, but if I do something like op[12345] = op[12345] + Output1 it hangs up the code.
I’m using the Memory node in xpresso to calculate Input1 & Input2 from the position of objectA, and trying to use the difference of that data to additively increase the position of objectB.
Any suggestions would be helpful. I’ve done some C.O.F.F.E.E. in the past, but totally new to Python.