Jump to content
Sign in to follow this  
RedbeansandRice

distance from object attribute in vellum solver

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

Share this post


Link to post
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.

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  

×