Jump to content

distance from object attribute in vellum solver


RedbeansandRice

Recommended Posts

Hello all!

 

I have been trying to figure out how to dynamically update the constraints in a vellum constraints property node based off of the distance of the vellum object from a given point in space, but I cant figure out how to make this calculation dynamically in this context. I can measure the distance before and after the vellum solver with a distance node but they only give me static values in the solver context so I dont know how far things are once theyve moved. Havent been able to get xyzdist to work either. Any help would be greatly appreciated as this project is very important to me!!

Link to comment
Share on other sites

Heyo,
If you are able to share your hip file that might be helpful to see more specifics. However, as a start, I made a small test in SOPS and was able to make xyzdist work in creating a dynamically changing distance. I'm not that used to using xyzdist so I don't know if this is the most optimal setup of it, I'm more of a nearpoint guy myself though this is way more accurate. Here is the vex code I used:

 

int prim;
vector uvw;

vector c = getbbox_center(0);
vector p = xyzdist(1, c, prim, uvw);

vector pos = primuv(1, 'P', prim, uvw);

float dist = distance(v@P, pos);

f@test = dist;

The "vector c" part is not that important, it's just where I choose as the origin of my measurements, you might want to use v@P or something similar.
Only other thing to note is that this is a wrangle where the thing you are measuring from is in the first input of the wrangle and what you are measuring to is in the second input.

Hope this can be of any help.

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...