OneBigTree
Sept. 5, 2014 13:06:05
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
Sept. 5, 2014 14:24:48
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
Sept. 5, 2014 17:44:26
Thanks Tomas, that's exactly what I was looking for. Great!
Sadjad Rabiee
Sept. 18, 2014 05:14:04
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
Oct. 24, 2014 10:28:51
Hey Joker, thanks a lot! Sorry, I just saw your post today. Much appreciated
Edit: foreach is a killer node! :shock:
tamte
Oct. 24, 2014 12:34:59
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