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++){

    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");