1
$\begingroup$

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

$\endgroup$
2
$\begingroup$

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.
$\endgroup$
5
  • $\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 Jan 8 '19 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 Jan 9 '19 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 Jan 9 '19 at 14:34
  • $\begingroup$ @SergeL Sorry, my bad. I updated the answer. $\endgroup$ – Omar Emara Jan 9 '19 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$ – David Gilson Nov 13 '20 at 23:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.