Cant react to created points within a loop within a wrangle

   1781   3   0
User Avatar
Member
11 posts
Joined: 12月 2016
Offline
I'm having an issue whilst trying to create a random walk algorithm purely within VEX. I have a single wrangle, and within that I've got a for loop that creates a point every iteration, as long as there is an available location. However it seems no matter what I try, the created points don't react to the previously created points, resulting in clipping or weird behaviour. I've tried debugging by creating a vector array attribute of all available locations for every created point, but they're always empty.

Is there something I'm missing?

Find attached a hip with a basic setup of what I'm trying to do. The end goal would be for a point to start at zero, and randomly walk either {0,0,1}, {0,0,-1}, {1,0,0} or {-1,0,0} WITHOUT clipping into other points, if it detects a collision, it moves down {0,-1,0}. I'd preferably want it to all happen on frame 0 as well since I want to make this into a procedural tool and drive the creation of other things.

Attachments:
RandomWalk.hip (153.0 KB)

User Avatar
Member
539 posts
Joined: 8月 2019
Offline
You can't create points and access them in a single Point Attribute Wrangle. addpoint() doesn't actually create points when it's called. All points are created at the end of Attribute Wrangle.
User Avatar
Member
11 posts
Joined: 12月 2016
Offline
Interesting! Is there a way around this? Or should I just treat points as a final thing and just work off arrays of positions and add all the points at the end?
User Avatar
Member
4726 posts
Joined: 2月 2012
Offline
Depending on the functions you want to use, you can do that using arrays as you suggested. Functions like pcfind/pcopen will require actual 3d points in your geometry so if you can avoid using these, then you can do all of this in a single wrangle node.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
  • Quick Links