Why doesn't this vex code work? I'm simply trying to increment a detail float value by 1 for every frame irrespective of what frame it's on. "currZrot" should always only increment when the frame is incremented (not decremented)
attribute wrangle set to run over "Detail".
"currZrot" is a detail attribute.
float curvalue = detail(0,"currZrot",0);
setdetailattrib(0,"currZrot",curvalue+1, "set");
vex can't update detail attribute when referencing itself.
2810 4 0- caesar
- Member
- 143 posts
- Joined: March 2014
- Offline
- tamte
- Member
- 8785 posts
- Joined: July 2007
- Offline
- It seems to work fine, assuming you are running it inside of the Solver SOP since you are expecting that geometry is fed back each frame to increment previous value
- also since you are running it as in Detail mode and also creating detail attrib you can just do
for the same effect
- also since you are running it as in Detail mode and also creating detail attrib you can just do
f@curvalue += 1;
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- caesar
- Member
- 143 posts
- Joined: March 2014
- Offline
this does work inside of the solver sop, but when attempting to change the condition while running, it doesn't seem to work. I need to conditionally update this attribute depending on another attribute:
if I stop and reset the simulation, it works, but not while running if I change the "spin" attribute to "0"
if(detail(0,"spin",0)==1) { f@currZrot += 1; }
if I stop and reset the simulation, it works, but not while running if I change the "spin" attribute to "0"
Edited by caesar - March 6, 2022 13:02:31
- tamte
- Member
- 8785 posts
- Joined: July 2007
- Offline
You are taking the spin attribute value from the first input which is geo from the previous frame in your case so that will always have spin value from the start frame unless changed within the solver
You can either sample the first input geo of the solver itself for the spin value
Or instead of operating directly in previous frame geo just copy attribs you want to preserve from previous frame geo onto live input geo yo further modify them
This will leave all other attributes live and updating from input
You can either sample the first input geo of the solver itself for the spin value
Or instead of operating directly in previous frame geo just copy attribs you want to preserve from previous frame geo onto live input geo yo further modify them
This will leave all other attributes live and updating from input
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- caesar
- Member
- 143 posts
- Joined: March 2014
- Offline
-
- Quick Links