Search - User list
Full Version: Copy to primitives
Root » Houdini Learning Materials » Copy to primitives
OneBigTree
I've been searching a while for that but couldn't find anything:

Is there a method to copy objects to primitive centers instead of points?

thanks
tamte
not directly, but it's easy to do
just use Attrib Wrangle, switch Run Over parm to Primitives and use this code to create centroid point per primitive:
addpoint(0,@P);
removeprim(0, @primnum, 1);
if you want your point to inherit some attributes from geometry, you can use primuv() for that:
int pt = addpoint(0,@P);
vector nml = primuv(0, “N”, @primnum, {.5,.5,0});
setpointattrib(0, “N”, pt, nml);
removeprim(0, @primnum, 1);
OneBigTree
Thanks Tomas, that's exactly what I was looking for. Great!
Sadjad Rabiee
although the best way is to use Attrib Wrangle SOP , but you have some other options for doing that , Also if you wanna add a point in center of each object or piece (e.g Fractures) , you should use another method , I made these methods for you.
:wink:
OneBigTree
Hey Joker, thanks a lot! Sorry, I just saw your post today. Much appreciated

Edit: foreach is a killer node! :shock:
tamte
if the fragments are packed primitives, you can just use Add SOP and remove primitives but keep the points
it will keep the centroids of the fragments and all the point attributes from packed prim
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB