Jump to content
SphericalCow

Break constraints problem setting attributes at sop level

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.
 

Share this post


Link to post
Share on other sites

All correct. When sop not create atribute but in wrangle you write it it equal 0. If you disable atribute in sop you have to delete it in wrangle.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Posted (edited)
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

Share this post


Link to post
Share on other sites

Thanks it really help finally got everythin working right:D

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

×