# Drive bone rot by another bone rot

## Recommended Posts

Posted (edited)

Hi , I'm doing this arm Rig,

I need to transfer the wrist rotation around it's axis

to the rotation of two other bones that are parent to the forearm(white Line),

I'm trying to do this in the rig VOP

I need to get the ROT 0 Value(The rotation perpendicular to the axis form the wrist to the forearm),

I try to much time to find the right nodes,

some ideda to hunt for this value would be awesome.

with that Value I'll by able to do the rest with the get and set points.

if there is other Vex or Sop KINEFX way of doing..

anything that can get me going on this problem , thanks!..

Edited by jmquintela
better question

##### Share on other sites

See if this helps. I've got 2 VOPs in the script. VOP 1 extracts the rotation from the local transform matrix of the parent joint and subtracts it from the extracted rotation of the rest position to get the amount the parent joint has rotated, then scales it and applies it to the child joint.

VOP 2 uses the matrices directly. It's a little less obvious, but it's something I did to try to understand better how to manipulate matrices (any suggestions are welcome). It's the same basic procedure but handling the matrices is a little different. In order to the get the difference between the parent joint and its rest position, you multiply the joint's local transform by the inverse of the rest position, then multiply it with the child joint local transform matrix. The bias is set with the blend transform VOP (I haven't found a way to limit the rotation matrix to something like .5 or .25 directly).

Haven't tested it fully, but it should be a start.

inherit_rotation.hiplc

##### Share on other sites

And thanks to a little help from @mestela, here's a pass at a VEX version. I was lazy and just looped through each joint and applied the previous joints transform according to a single bias. If you want each joint to have its own bias, you could code things a little different. Again, I haven't tested it fully, but hope it helps:

```#include <kinefx.h>

int     start_ptnum;
int     pts[];
float   bias;
matrix  parent_localxform;
matrix  parent_rest;
matrix  descendant_xforms[];
matrix  descendant_localxforms[];
matrix  descendant_efflocalxforms[];
matrix  offset;

start_ptnum = chi("Start_point");
bias = chf("Inheritance_bias");
parent_localxform = point(0, "localtransform", start_ptnum);
parent_rest = point(0, "rest_transform", start_ptnum);

offset = parent_localxform * invert(parent_rest);

updatedescendanttransforms(0, start_ptnum, -1, matrix(), matrix(), pts, descendant_xforms, descendant_localxforms, descendant_efflocalxforms);

foreach (int i; matrix descendant_localxform; descendant_localxforms) {
descendant_localxforms[i] *= slerp(ident(), offset, bias);
}

setpointlocaltransforms(0, pts, descendant_localxforms);```

##### Share on other sites
Posted (edited)

thanks a lot!, andthank to Mateo too!, I'll check on those and tell you How it went

Edited by jmquintela

##### Share on other sites

Sorry for the very delayed answer, too much work this days...

I checked the vop version and it was worked perfectly, I did split the rot value touse the Y axis only, If you can check if it's the correct way of doing it would be awesome( in case there is a better/easier way..), but it worked at least..

but about the vex example I try to make it work but I could, also I try to find docs on the updatedescendanttransforms() function to understand it better but I couldn't.. also didn't get where in the code I target the point wich I'm going to transfer the rotation and also how I can target just one dimension of the rotation to it( as I did in the vop)... I attach the houdini file ..

TRigTestOdF_v22.hiplc

## Create an account

Register a new account