Point deltas

   1689   2   1
User Avatar
Member
50 posts
Joined: 5月 2015
Offline
I have an asset I'm trying to create. In an attribute wrangle I accept three inputs, a resp pose, a potenially animated figure, and a part of the same figure that is animated but basically at the rest pose. I want to get the animated part onto the full figure at the full figures position. It'd be similar to stacking blendshapes on top joint deformation in another package.

I came up with the this code


//input 1 is animated part
//input 2 is rest pose
int pt = findattribval(1, “point”, “pindex”, @ptnum);

if (pt!=-1) {
vector deltaP = point(1, “P”, pt) - point(0, “P”, pt);

@P = deltaP + point(2, “P”, pt);
}


So basically I subtract the animated part of the character from the full figure to get a delta. then I add that to the rest pose for the final position. Vector math always get jumbled in my head, and obviously this current code doesn't work. The findattribval use a previously created pindex attribute to transfer position from a prior deleted part that I rig and dynamic in another package.
User Avatar
Member
702 posts
Joined:
Offline
if the two inputs are the same topologically, you shouldnt need the findattribval…imo


vector deltaP = @opinput1_P - @P;
@P = deltaP + @opinput2_P;


does this work for you ?
User Avatar
Member
50 posts
Joined: 5月 2015
Offline
Yeah with a few tweak I got it. My topology is different for the input one, hence the pindex lookup. Where I was messed up was the pt in the point expression. For the topologies that matched I needed to be using @ptnum instead. Thanks for your assistance, your code helped me have that final ah ha moment.
  • Quick Links