Jump to content

Break constraints problem setting attributes at sop level


SphericalCow

Recommended Posts

Hello OF,

I have a small issue which I hope you can help with...

I am creating attributes at SOP level to control the breaking of constraints in a SOP Solver in DOP's using the 
following VEX code in an attribute wrangle connected to 'relationship geometry' of the SOP solver.

if (s@constraint_name == "pin_between"){
    if ((f@torque>@break_torque||@angle>@break_angle||f@force>@break_force)){
        s@constraint_name = "pin_broken";
        i@breakframe = @Frame;
    }
}

My issue is that when I disable one of these attributes at the SOP level, the sop solver seems to interpret it at a value of 0, and
the objects constraint will be completely removed on collision.

Is there a better function to use than 'or' in this situation? An 'if else' seems more appropriate, but I am unsure of the syntax of 
that in this situation within VEX. 

Any help would be greatly appreciated.

Many thanks in advance.
 

Link to comment
Share on other sites

  • 1 year later...

Hello i'm trying to break my hard or glue constraints but it doesn't work

if (@constraint_name == "hard"){
  if (f@torque > 7500 || f@angle > 10 ){
      s@constraint_name = "hard_broken";
      }}

Screenshot_1.jpg

Screenshot_2.jpg

Link to comment
Share on other sites

hard constraint use force only.

Try this

if (@constraint_name == "hard" && length(@force)>1000){
	s@constraint_name = "hard_broken";
}

or I use this one

if(@constraint_name == "hard"&& length(@force)>1000)
	removeprim(0,@primnum,0);

Glue constraint used strength attribute to brake

Edited by tamagochy
Link to comment
Share on other sites

3 hours ago, johanfx said:

none of those are working. could please send me a set up file. so i could see it please!!

Strange it doesn’t work... maybe it is breaking and deleting the primitive correctly, but reimporting it from sop afterward ?

To avoid that, check if your constraint network in SOP context (outside DOP, where the Geometry Source of you Constraint Network is pointing to) is « animated » or considered time dependent. In this case, you have to manually set Overwrite with SOP to 0 on the Constraint Network DOP node, and delete the default expression inside this parameter. 

In short, it will import your network once at the start, and then relationship will live only inside DOP without being updated from SOP.

And check that your display flags are set correctly to your last node in SOP Solver, sometimes i make this simple mistake :-)

Edited by StepbyStepVFX
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...