Jump to content

How to rotate points stored inside an array attribute in vex?


Recommended Posts

Hi,

I have a problem I'm struggling with vex code; I have a line with 3 points for example and I created an array attribute called "parentPt" that tells for every point of the line which are the related points. After that, I want to rotate those points in the array around the current pt that has the attribute.

For example, I have a line with 3 points; point 0 has [1,2] as parentPt attrib, point1 has [2], point 2 has an empty array []. I want to rotate pt1 and pt2 around pt0 then rotate pt2 again but around 1 and so on. 

It is a little bit difficult to explain, so I attached an hip file.

Any help would be really appreciated.

Thanks!

 

 

Odf_Example.hipnc

Link to comment
Share on other sites

So basicly you want to bend the curve? 

When you try to do it on a per point basis the surrounding points will work on "old" positions and they will not get the updated position. You need to rotate all your points from the first point, then the first point is free, and then you start with all the points from the second one and so on. And all the affected points needs to know where the new location of the "parent" is. Its easiest to do this per primitive, since one curve is a prim.

Heres an example of how i would do it.

 

Odf_Example_fix.hipnc

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...