Jump to content
Atom

[SOLVED]Set Velocity On Glue Bond RBD Piece?

Recommended Posts

Atom    516

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 by Atom

Share this post


Link to post
Share on other sites
Sierra62    59

I would try using the match function.

Quote

if(match("*broken*", s@name)){
    v@v = 23;
}

 

Share this post


Link to post
Share on other sites
Atom    516

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 by Atom

Share this post


Link to post
Share on other sites
Atom    516

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.

 

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites
Atom    516

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

breaker1.gif

Edited by Atom

Share this post


Link to post
Share on other sites

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

glue_to_vel.gif.gif

broken_to_vel4.hipnc

Share this post


Link to post
Share on other sites
Atom    516

Cool, that is a nice alternate. And with setting the i@init=1 that prevents any re-triggering.

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

×