Sunday, 14 May 2017

How to Create Custom Constraints for Your Ragdolls in VEX

In this tutorial I’m talking about how to create custom constraints in VEX for your ragdoll sim. Unfortunately I got over my 10 minutes limit, but there was just so much stuff that I needed to squeeze in.

It’s a bit technical so you probably need to have some basic understanding of VEX and ragdolls to be able to appreciate it.








If you don’t want to write the code yourself you can copy it from here:

int number_of_agents=npoints(1)-1;

string left_hand;
string right_hand;

int pointID_left;
int pointID_right;

for(int i=0; i<number_of_agents;i++){

left_hand=sprintf("mocapbiped3_%d/LeftFingerBase_To_LeftHandIndex1",i);
right_hand=sprintf("mocapbiped3_%d/RightFingerBase_To_RightHandIndex1",i+1);
   
    pointID_left=findattribval(0,"point", "name", left_hand,0);
    pointID_right=findattribval(0,"point", "name", right_hand,0);  
 
    int primID=addprim(0,"polyline", pointID_left, pointID_right);
    setprimattrib(0,"constraint_name", primID, "Pin","set");

}

8 comments:

  1. Nice tute. I just finished a simple tvc using houdinis crowd. First real project I've done with Houdini. Something that stumped me was getting agents to blend from ragdoll back to another state with mocap in it. Best I could get was a hard pop. Any ideas on how to overcome that one?

    ReplyDelete
    Replies
    1. Thanks! I haven't actually tried that so I would need to do some experimenting, but you probably would need to read the agent transforms in the intrinsics and do the interpolation in a sop solver yourself to avoid popping.

      Delete
    2. haven't been using houdini that long so until you mentioned intrinsics then I had no idea you could even get those transforms out of the packed prim for the crowd :)
      Really like your crowd tutes as I'm learning a lot from them. I've high hopes of really diving into the crowd system and being able to customize it a lot. Your tutes give me a great idea of what sort of things are possible and how to approach them.
      PS. my previous reply seems to have tagged me as unknown but looks like on my workstation its realised my google profile, so above Q was from me.

      Delete
    3. I'm happy to hear that!:) I think what makes Houdini my favorite tool for crowds is that nothing is hidden and you can just do it yourself if it's not there already. Being able to go in and set the transform matrices yourself have saved me more than once.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Hi Mikael, please do you have any tips for controlling agent mass and rotational stiffness. Right now, my agents feel light and rotate way too much than I need. Thanks.

    ReplyDelete
  4. Hello Mikael, thx for this video ! I'm searching for a solution quite similar to what your proposing here, but not exactly the same : would you know how is it possible to pin each character (in a crowd simulation) to the points of a moving geometry, with the ragdoll active on each respective bodies ? Like dead puppets hanging to and folowing the points of the geometry it populates.
    Thanks in advance :)

    ReplyDelete