Bone angle at different frames.

   1761   6   0
User Avatar
Member
17 posts
Joined: April 2014
Offline
Greetings,

I'm using the boneangle expression in my rig to drive secondary animation. It works fine, however, I would like to sample the angle between the two bones on different frames, once at frame 0 and again at the current frame, so I can work with the difference in angle between the setup pose and the current pose. How can I do that?


Thank for any help.
Edited by Tralen - Dec. 9, 2019 11:46:37
User Avatar
Member
17 posts
Joined: April 2014
Offline
I would like to add that I managed to get the effect I want by adding “ghost” bones that stay in the original position of the bones I'm measuring, that way I always have a reference for the setup pose. That is far from an elegant solution, however, and a better idea would be most welcome.
User Avatar
Member
41 posts
Joined: Sept. 2013
Offline
You could use a chf(“../boneangleparm”, 0) expression on another parm to get the boneangle expression at frame 0. Then subtract it from the current bone angle to get the difference. You could also use fit() on the difference to get a normalized value to drive shapes or other secondaries.

It might not be elegant for all situations, but it works in this case.

Attachments:
boneangle_difference.hiplc (125.7 KB)

User Avatar
Member
17 posts
Joined: April 2014
Offline
Thank you, it worked beautifully!
User Avatar
Member
17 posts
Joined: April 2014
Offline
Here is a HDA which encapsulates the functionality. Given two bones, it will calculate the angles (absolute and relative to the reference frame), normalize the results given a min and max, and generate attributes for the values.

Edit: In the second (larger) file, I gave up using the boneangle expression because it didn't provide negative ranges, so I built another method with VOPs.
Edited by Tralen - Dec. 10, 2019 13:24:20

Attachments:
TRA_bone_angle.hda (31.5 KB)
TRA_bone_angle.hda (39.0 KB)

User Avatar
Member
41 posts
Joined: Sept. 2013
Offline
Thanks, that's cool.

Interesting how you're using the determinant of your constructed matrix to get a full 0 - 360 deg angle. I don't pretend to understand bit of the math, but it looks very useful!
User Avatar
Member
17 posts
Joined: April 2014
Offline
Hey, Stephen,

I don't understand that bit all that well, it is just something that I picked.

One more update to the HDA. I added functionality to deal with unpacked bones and moved all of the calculations to VOPs.

Here is something interesting and perhaps useful. I had to use the chf() function in an inline vop because there isn't a node for that function. To get the reference parm for chf() I had to split the VOP tree into two nodes, that way I could build an attribute for the parm in the first one, and then read it and build the parm proper in the second one. Trying to do both in a single tree generates an infinite recursion error.

Notice that chf() needs a string for its first parameter (the path to the reference parm), so I created a string parm for that, containing the path for the parm built previously.

Attachments:
TRA_bone_angle.hda (45.2 KB)

  • Quick Links