ForEach Global Variable

   2271   3   1
User Avatar
Member
140 posts
Joined: Aug. 2010
Online
Dear Forum.

I need to make a trace through a primitive surface. I want to start at one point on the surface and then for each step make a decision to which of the connected neighbors to move to next. For decision I have a certain algorithm.

The problem is that I need this to happen instantly on each frame and I have a hard time figuring out how to use a ForEach or a VOP SOP to achieve this.

The problem right now is that I can't think of a way to store “global” (not in Houdini terminology) variable stating which point to process next. Say after the first iteration I'm at point “12”, next time it evaluates the loop I want to start from point “32” which was the point I moved to from point “12”. How can I using a ForEach or VOP SOP store a value within the iteration which is then accessible to the next iteration or execution.

If doing this in processing or other pure programming environment is rather easy. I reckon the ForEach abstraction can sometime make it tricky. I still don't get the what the Each node does. Maybe someone has some good reference. Explanation?

Thanks you.

Attachments:
trace.jpg (460.8 KB)

B-System for Houdini [ae43ae43.gumroad.com]: instance editor, blender like interface.
User Avatar
Member
1391 posts
Joined: Dec. 2010
Offline
I think you wanna do something like my project about “Edge/Point Loop Node” ,Check my attached file : :wink:

Attachments:
JKLoop_Tool.zip (199.6 KB)

https://www.youtube.com/c/sadjadrabiee [www.youtube.com]
Rabiee.Sadjad@Gmail.Com
User Avatar
Member
8071 posts
Joined: July 2005
Offline
smuseus
The problem right now is that I can't think of a way to store “global” (not in Houdini terminology) variable stating which point to process next.

The most straight forward way off the top of my head is to create a “detail” class attribute and store your information in it. You can then retrieve it via the detail() (or details()) expression.
  • Quick Links