Adding vertices to primitive inside POPnet doesn't work

   999   1   0
User Avatar
Member
13 posts
Joined: Aug. 2017
Offline
Hi!

I have a really simple setup, a sphere that goes into a POPnet. A couple of particles are spawned each frame on the surface of the sphere and are affected by a POP wind node.

I run a POP-wrangle for the particles in the justborn group that simply:

addprim(0, “polyline”, @ptnum);

Now every newly spawned point will be part of a new polyline.

Now I want to add points every frame of the simulation and add these points as vertices to the polylines. So I have another POP wrangle after the first one:

// add point and vertex
int p = addpoint(0, @P);
int prims = pointprims(0, @ptnum);
addvertex(0, prims, p);

This only produces one primitive, since the pointprims seems to return 0 all the time. Is there no way of constructing polylines inside a POPnet?
Edited by Erik - May 25, 2019 06:28:03

Attachments:
plant.hipnc (257.1 KB)

User Avatar
Member
1743 posts
Joined: May 2006
Offline
Here's a few ways.

The first is closest to what you were attempting in vex. The main thing was to make sure the setup didn't keep creating new prims for every newly added point, so I put in a test to see if any prims exist with the same @id as the current particle, if not, create the prim. The other thing to was to make sure the newly added points don't get affected by forces, so I set them to be @active=0.

The second method splits off the geo creation into a sop wrangle inside the popnet, its a little cleaner (but not really).

The third is what I usually do; leave the popnet clean, and do the geo creation in a sop solver afterwards. No vex, nice and simple.

Attachments:
plant_me.hipnc (329.9 KB)

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
  • Quick Links