Jump to content

Cloth constraint length


revelationsr

Recommended Posts

Hello.

I am using a Vellum SOP solver. I have a grid animated, it is following a path. I have a matching geo of the grid being simulated. I have attached a "target to geometry" constraint so the simulated cloth is now following the animated cloth attracted to the matching point order.

With in the vellum solver (so at simulation time) I would like to change the stiffness of this constraint. I have a geometry wrangle that is bind to the "ConstrainGeometery" and I have a group to isolate the constraints. So I can change at sim time the stiffness. This works as expected. So far so good.

My problem is the next step. I want to measure the length of the constraint. Some how I want to grab each constraint. Find the 2 points that makes it up. Then measure that distance. Ultimately I want to plug that into a ramp and manipulate the stiffness based on how far apart the sim geo points are from the animated points. Example. Close low pull. Far high pull.

Any thought would be appreciated. 

clothConstraintTest.hipnc

Link to comment
Share on other sites

Geometrywrangle > Inputs > Input 1 > Myself

// stiffness is working because now it no longer is "stuck" to the animated geo

@stiffness = .001;

// find pt0
// find pt1
int pt0 = primpoint(0, @primnum, 0);
int pt1 = primpoint(0, @primnum, 1);
vector pt0p = point(0, "P", pt0);
vector pt1p = point(0, "P", pt1);

// length = (pt0, pt1)
f@rlength = length(pt0p-pt1p);

// chf get max_distance
float md = ch("max_distance");

// normalized_length fit01 ( 0, max_distance)
//chramp ("stiffness ramp" , normalized_length)
f@nrlength = chramp("stiffness_ramp", fit(f@rlength, 0, md, 0, 1));

//chf get stiffness_multiplier

//float stiffness = ramp_value * stiffness_multiplier;
@stiffness = f@nrlength * ch("stiffness_multiplier");

//f@stiffness = stiffness;

 

Link to comment
Share on other sites

@Fencer.

Thank you for the response. What I had originally is very close to what you have there. I put it in the setup and it is not working. I honestly dont know what I am missing.

The scene bellow has the script above in it. In theory the cloth should rise up and when it gets about 1/4 of a meter away it should yank towards the animated geo.

 

clothConstraintTest.hipnc

Link to comment
Share on other sites

30 minutes ago, revelationsr said:

@Fencer.

Thank you for the response. What I had originally is very close to what you have there. I put it in the setup and it is not working. I honestly dont know what I am missing.

The scene bellow has the script above in it. In theory the cloth should rise up and when it gets about 1/4 of a meter away it should yank towards the animated geo.

 

clothConstraintTest.hipnc 618.85 kB · 0 downloads

Set wrangle input
Geometrywrangle > Inputs > Input 1 > Myself

clothConstraintTest_01.jpg.4da9acb4b5e084f835d478a28e35636d.jpg

Analyze data before choosing values and final multiplier.

clothConstraintTest_02.thumb.jpg.4c0378c3c90e4ff2d753732e3286f405.jpg

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