In this setup Random number defines Y position of Empty, which is shrinkwrapped-constrained to "Array of stairs".

I'd like to save Z value (orange circle) in memory, when the first positive number will be generated (green circle) and keep it until animation ends. And please, do not modify Random number node.

enter image description here

EDIT: I've added another attribute to workaround saving value from previous frame. Looks messy, but works. enter image description here


1 Answer 1


Attributes can be stored in memory during the life time of the blender instance as described in this answer. In this particular case, the logic is as follows. We have two variables occurred, storedValue:

  • If the current frame is equal to the start frame, reset storedValue to some initial value and reset occurred to False.
  • If trigger value is positive:
    • If occured is False:
      • Set storedValue to the value.
    • Set occurred to True.
  • $\begingroup$ Thanks, part of the job is done - I can keep value imgur.com/a/zTQ3cFI But as expected it getting overwritten once there is another positive number in next frames $\endgroup$
    – Serge L
    Commented Jan 8, 2019 at 19:58
  • $\begingroup$ @SergeL You also need to check if the variable already stored is positive, if it is positive, then you shouldn't change it. So you should do x > 0 as well and factor that. Makes sense? $\endgroup$
    – Omar Emara
    Commented Jan 9, 2019 at 11:42
  • $\begingroup$ I don't understand why X>0, if it is just "Z loc" and can be any number? I added condition that forces X to be written only when attribute is empty and it solves "rewrite problem", except it saves wrong value (on previous frame, not current) imgur.com/a/FZCe8zm $\endgroup$
    – Serge L
    Commented Jan 9, 2019 at 14:34
  • $\begingroup$ @SergeL Sorry, my bad. I updated the answer. $\endgroup$
    – Omar Emara
    Commented Jan 9, 2019 at 15:39
  • $\begingroup$ Is there anyway to do this without depending on frame numbers? I need to do something similar, but not necessarily animated. $\endgroup$ Commented Nov 13, 2020 at 23:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .