Jump to content

Recommended Posts

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.


Share this post

Link to post
Share on other sites

- 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);  




Edited by anim
  • Like 3
  • Thanks 2

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now