Jump to content

decrementing a attribute per frame


TeaLeaf

Recommended Posts

Hi Guys,

If I have an attribute called chicken (for example) how do I decrement it by 1 each frame in VOPs. I thought I could just attribute import it, subtract constant, and use a parameter/bind to export it again. I'm sure I've done it before but I can't remember how!

Cheers

Link to comment
Share on other sites

Hi,

There are two ways I can think of to do this.

The first is pretty much what you're doing: simply import the attribute and subtract the current frame from it.

Alternatively you could use the solver SOP. See the attached hip files.

The reason simply subtracting a constant doesn't work is that SOPs are not time aware. Each time you increment a frame the network will cook again. As a result on each frame it will create the default chicken value and subtract the same constant from it, and thus the value won't change. Thus you need to use the frame variable ($F) somewhere, or the solver SOP.

Anyways, hope that helps,

Jules

subtractChickenSOP.hipnc

subtractChickenVopSop.hipnc

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...