Atom Posted August 31, 2017 Share Posted August 31, 2017 (edited) Hi All, I have a set of RBD objects that are glued together. I have detected that the bond is broken and have the @primnum of the relationship geometry and the s@name of the RBD piece. if (v@Cd.r == 1.0) { removeprim (geoself(),@primnum,1); printf("breaking glue bond on %s\n",s@name); } How do I use the s@name to assign velocity to the piece? Is there a VEX function like set velocity by name, or something similar? Edited September 3, 2017 by Atom Quote Link to comment Share on other sites More sharing options...
Sierra62 Posted August 31, 2017 Share Posted August 31, 2017 I would try using the match function. Quote if(match("*broken*", s@name)){ v@v = 23; } Quote Link to comment Share on other sites More sharing options...
Atom Posted August 31, 2017 Author Share Posted August 31, 2017 (edited) Hmm..but the name will never be equal to broken, it is just the name that the relationship geometry it is connected to. Also setting v@v will just apply velocity to the glue bond I just removed. That is the problem I am running over primitives of the glue bond relationship geometry. So I need a way to fetch the actual RBD packed object based upon the s@name provided by the glue bond relationship geometry, then I could apply velocity to that fetched RBD object. Edited August 31, 2017 by Atom Quote Link to comment Share on other sites More sharing options...
julian johnson Posted September 3, 2017 Share Posted September 3, 2017 Probably too late on this one but the findattribval() function is one you could use here: broken_to_vel.hipnc 1 Quote Link to comment Share on other sites More sharing options...
Atom Posted September 3, 2017 Author Share Posted September 3, 2017 Thanks for the example file. That can come in handy, I think. I wonder why the pieces are no longer affected by gravity though? Is the solver applying that velocity every frame after the bond is broken? Ideally it would be nice if it were just applied once, when the bonds break, like an Impact or Impulse. Quote Link to comment Share on other sites More sharing options...
julian johnson Posted September 3, 2017 Share Posted September 3, 2017 Just tried to update the .hip and realised it doesn't work at all! So, please ignore. I am sure findattribvalue() is the way to do this but the code in the wrangle is wrong. It 'looks' like it works but really isn't. Will try and update when I get a chance. Quote Link to comment Share on other sites More sharing options...
Atom Posted September 3, 2017 Author Share Posted September 3, 2017 (edited) Here is an example file that was presented on Discord, by user name Fra, as a possible solution. It has a simplified SOP Solver that just uses an Object Merge and group to transfer pre-calculated velocity from the object's surface. This is basically what I ended up using, with some small tweaks. ConstraintsVel.hip Edited September 3, 2017 by Atom Quote Link to comment Share on other sites More sharing options...
julian johnson Posted September 4, 2017 Share Posted September 4, 2017 Thanks for that scene Atom. I couldn't NOT finish what I started :-). So here's the fixed scene. In the sop solver it identifies which constraint geo primitives are marked as broken and then, at the frame they are broken, adds velocity to the packed RBD associated with the broken constraint. I think it's a relatively simple setup and, obviously, in the wrangle you could do anything you liked to the velocity at that frame. Hopefully this one works as it should! In the .hip file the pieces associated with broken glue constraints are all pushed positively along Z with a new velocity of (0,0,5). broken_to_vel4.hipnc Quote Link to comment Share on other sites More sharing options...
Atom Posted September 4, 2017 Author Share Posted September 4, 2017 Cool, that is a nice alternate. And with setting the i@init=1 that prevents any re-triggering. 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.