Jump to content
julian johnson

vex - Using @primnum in point mode or @P in primitive mode

Recommended Posts

I noticed a couple of clever tricks in recent sample scenes/tutorials both of which involved calling vex functions with either @P or @primnum in the 'wrong' mode e.g.

In Primitive Mode:


In Point Mode:


In the first case it looks like the primitive calls the average of all the point positions associated with the primitive whilst in the second case the function successfully identifies the primitive connected to the point and deletes it although, I imagine, only because the primitives have been uniqued.

I couldn't find any documentation on this behaviour or on what would happen if say, in the second case, the primitives were not unique i.e what primitive number would get returned on a point calling @primnum that had multiple polygons attached? Just wondering if it's safe to 'rely' on these methods or if they're likely to change i.e. might it be just as valid for addpoint(0,@P) to return the position of the first point on the primitive rather than the average?

Edited by julian johnson

Share this post

Link to post
Share on other sites

For the point mode case you could always just assign @primnum to an attribute so you could observe the result of making them unique in the Geometry Spreadsheet. When I did this it does look like @primnum is reliably set to the current associated point for that primitive.

@view_primnum = @primnum;


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