Increment a Value with Expression

   6697   5   2
User Avatar
Member
3 posts
Joined: July 2010
Offline
i am new so bare with me.

imagine theres a sphere at the origin and i want to translate it in the Y direction by 0.1 increment at each frame.
How do i do this with an expression?(no keyframe)
so in general how to increment a value like say $TY++.
i tried using $CEY++ on a transform node but it doesnt work.

Thanks in advance
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
$F * 0.1 ?
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
3 posts
Joined: July 2010
Offline
thank you graham that worked.
but how to increment a value like in java or c++. (like $var++)
is there any increment operator like that in hscript.
one more thing buddy

how do i view the textures in the viewport.
i enabled the Display Textures in misc tab of the Display Options.
and applied a checker texture to the chekerboard pattern to a sphere.
but the texture doesnt show up in the viewport. It renders alright.
i tried applying a uvtexture node but no good
User Avatar
Member
789 posts
Joined: April 2020
Offline
The ++ operation wont work the way you hope it will. There could be a theoretical ++ which would be $TY+1. However, this wont carry over from frame to frame. Sop's is a context with no “history”.

There are workarounds for this, like the feedback sop, but the general design is that each frame is evaluated independent of other frames. The output of the graph is not the input on the next frame, the whole scene starts clean every frame.

To do something like you are describing, have a look at the “sop dop”, which is a sop context living inside dop's thus being able to use the caching in that context.

However, if you can describe your function based on $F that will be much easier and faster.

Cheers,
Koen
User Avatar
Member
3 posts
Joined: July 2010
Offline
Thank You Koen.

i tried using a sop solver and then use $CEY to move it up and it kinda works.
Theres is this Tutorial by Peter Quint on Vimeo about SOP Solver that partially explains it.
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
If in DOPs, have a look at the help on most any DOP. There will be a tip in there indicating that you can querry any paramter value's previous value by simply putting a $ infront of the parameter “name”.

For example to move an RBD object by a unit each time as an incrementor, you can insert a Motion DOP after the RBD Solver DOP and for it's Position X or “tx” parameter, use:

$tx + 0.1

Done.
There's at least one school like the old school!
  • Quick Links