Mozzarino Posted October 8, 2018 Share Posted October 8, 2018 Hello everyone, I am trying to recreate a volume trail node within an attribute wrangle (couple steps before, but the advection of the points is all within the wrangle) When I create new points in said attribute wrangle, I can't have access to their position within the for loop they were created. I am attaching the hip file. The attribute wrangle is highlighted in red. volume_trails_VEX.hip Quote Link to comment Share on other sites More sharing options...
anim Posted October 9, 2018 Share Posted October 9, 2018 (edited) - rather than doing it in detail wrangle use point wrangle as you want trail per point - also you can create prims directly in wrangle too so no need for id - addpoint() can take reference ptnum which it will clone with all the attribs so no need to import the attribs manually - and to your question, no, it's not possible to access attributes from new points as the creation will happen at the end as a separate single threaded process, all you are doing with geometry creation functions addpoint() setpointattrib(), ... is queuing those for later here is a simple pointwrangle volume trail code: float step = chf("step"); int niter = chi("niter"); if (niter <= 0) return; int prim = addprim(0, "polyline"); vector P = @P; vector v = 0; for (int i=0; i<=niter; i++){ int pt = i == 0 ? @ptnum : addpoint(0, @ptnum); addvertex(0, prim, pt); P += normalize(v)*step; v = volumesamplev(1, "vel", P); setpointattrib(0, "P", pt, P); setpointattrib(0, "v", pt, v); } volume_trails_VEX_fix.hip Edited October 9, 2018 by anim 3 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.