Bone angle at different frames.
1761 6 0- Tralen
- 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.
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
- Tralen
- Member
- 17 posts
- Joined: April 2014
- Offline
- Stephen Bester
- 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.
It might not be elegant for all situations, but it works in this case.
- Tralen
- Member
- 17 posts
- Joined: April 2014
- Offline
- Tralen
- 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.
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
- Stephen Bester
- Member
- 41 posts
- Joined: Sept. 2013
- Offline
- Tralen
- 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.
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.
-
- Quick Links