Jump to content
Sign in to follow this  
Triplett

Driving point position from a different vector attribute

Recommended Posts

I am certain that this is a simple question, but I am still struggling with it. I have a vector attribute called "centroid" on a bunch of primitives, and I want to create a point cloud whose P values match the centroid positions. I could use any of David Kahl's methods here https://www.youtube.com/watch?v=iyZ8dIqJ47U if I wanted a point at the centroid of every prim, but instead I have several prims with the same "centroid" vector because I obtained it by running "extract centroid" over prim pieces via a for-each loop. My instinct is that this is a super simple VEX expression like: @P = @centroid;   But that is obviously wrong. I also tried the set expression, but that didn't seem to work either. 
Is this like "promoting" an custom attribute into an intrinsic one like "P?"

Share this post


Link to post
Share on other sites

too long to read, just upload your file.

Share this post


Link to post
Share on other sites

Fenolis: Thanks, that works great if you want a point at each prim. What you shared looks like one of David Kahl's methods above. 

The issue I have is the centroid attribute is the same for different sets of prims. In pseudocode what I want is v@P = v@Centroid, so all of the prims or points could be moved to their corresponding centroid positions. Unfortunately I can't get that syntax right.

Noobini: I'd like to share the file, but it uses a big json file and a bunch of other dependent files in order to create the attributes. It is too big to upload and download all that.

Share this post


Link to post
Share on other sites
Posted (edited)

Hi,

you can use addpoint() function on each prim to add the vector attribute as point. You can remove the prims after this and you can also apply fuse to remove duplicates. You can also apply the add function on subsets (groups) if needed.

prim_vector_attribute_add.hipnc

Edited by Aizatulin

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
Sign in to follow this  

×