asnowcappedromance Posted September 11, 2020 Share Posted September 11, 2020 Hi guys, It's been a while since I had to use constraints and I was hoping somebody can help me out here I'm trying to dynamically fracture 2 boxes that are constraint to 2 static boxes. I then want to delete the old constraints on the fly (that part works but for some reason it happens one frame too late, why?) and constrain the new frags to each other. This part doesn't work at all I'm using the technique described in the file above, but for some reason my constraints go haywire. I hard-coded the first box to refracture on frame #30, the second box does the same on frame #60. Hip file and screenshots are attached, thanks so much for taking a look! Cheers, Manu dynamic_constraint_problem.hip Quote Link to comment Share on other sites More sharing options...
anim Posted September 11, 2020 Share Posted September 11, 2020 1. the 1f offset may have something to do with evaluation of the constraints if they are nor attached to an object, which is once per dopnet substep if you want it more precisely (during Bullet substeps) you will need to check Attach Internal Constraint to object and connect it just after object, but then you will have to have your active and passive rbds part of a single object, so a bit of rearranging the setup, but regardles at least it sort of works 2. seems like intrinsic transform is not reliable way to assume the initial pose, so I'd go back to using p@orient and v@pivot attributes as described at the beginning of this thread something like this: int found_pt = findattribval(1, "point", "name", s@name); if(found_pt != -1){ vector pivot = point(1, "pivot", found_pt); vector P = point(1, "P", found_pt); vector4 orient = point(1, "orient", found_pt); orient = qinvert(orient); v@P = qrotate(orient, v@P - P) + pivot; p@orient = orient; } also I made sure @restlength is initialized and computed in your file as it's necessary for spring constraint and switched f@strength attrib to prim as it's per constraint and also added switch to Soft constraint if you want to use that instead and tweak strength maybe as its much more stable than spring and has greater range of stiffness (I included f@stiffness prim attrib that controls it instead of f@strength which controls spring one) I may have changed something else while playing (I temprarily replaced your primcenter HDA as it was not embedded) dynamic_constraint_problem_fix.hip - alternatively you can also have the fragments glued together from the beginning and have the spring or soft constraints set as secondary constraints (s@next_constraint_name and s@next_constraint_type), then just break the glue when you need or with impacts and it should switch to secondary ones even during substeps 3 1 Quote Link to comment Share on other sites More sharing options...
asnowcappedromance Posted September 11, 2020 Share Posted September 11, 2020 Hey Thomas, Good to hear from you and thanks for chiming in! I really appreciate you taking the time to answer this, that was a huge help. And also thanks for the additional pieces of information, I was not aware of the s@next_constraint_name and s@next_constraint_type attributes. Hope things are well in NY! All the best, Manu Quote Link to comment Share on other sites More sharing options...
asnowcappedromance Posted December 15, 2020 Share Posted December 15, 2020 Hi guys, It's been a while, I didn't expect to post in the same topic again so quickly. Oh well, it seems constraints don't work as I think they should. This time I have a slightly different scenario. I start with a box in a Dopnet, which I swap to a fractured geometry on frame #1006 As you can see in the right image, the constraints are being applied with an offset. I'm transforming the constraints back to their rest position as suggested by Tomas 2 replies above in this thread. The swapping of the geometry happens in the "refrag" SOP Solver, in which I also calculate the constraints directly. The "sopsolver1" that's connected to the constrain network then directly object merges those constraints and adds them to the relationship geometry stream. I'm making sure not to change the point order by adding new ids to the new fragments (if the original box has id 0, then the new fragments have ids 1,2,3,4). Interestingly my approach of creating constraints on the fly works, if I don't swap the objects, but start with the 4 fragments from the start of the DOP simulation. You can have a look at the working example as well, you'll find it in the green network box in SOPs. If somebody could help me out here, that would be much appreciated. Why is this offset applied even though I move the constraints back to their rest position? It's a big enigma to me right now. Please let me know if you need any additional info to debug this problem. All the best, Manu Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.