Hello everyone.
I have this motion captured data corresponding to a human character animation.
I want to perform some pre-prossesing motion analysis stuff like to calculate kinematic parameters for each joint of my skeleton.
Thus I need the position of each joint per frame.
For example if we want the direction.x of the pelvis at
frame 2 we subtract the position.x of the joint at frame3 with the position.x of the joint at frame2.
In order to find these positions per frame I am using the AnimationUtility.GetEditorCurve(...)
This works well for the root joint(pelvis in my case)
but doesn’t work for the other joints like hips , ankles etc.
The case is that in the root bone there exist animation curves for the translation.x , translation.y,and translation.z( I can check that in the Animation View window in Unity ).
However , for the other joints there exist only rotational data.
This means that if I try to find the animation curve of the left hip by saying:
Animation curve xCurve = AnimationUtility.GetEditorCurve(animationClip,"jointName",typeof(Transform),"m_LocalPosition.x");
it will return a null reference since nothing exists
So, to the point:
How can I create (with scripting) this animation curve??
I know that I can create an empty animation curve and for each keyframe (mapped to a frame in my data) add the position data as it exists in the prerecorded animation, but I dont know how to retrieve this data.
In other words I don’t know how to find the
myJoint.transform.position.x value at a specific frame.
Any suggestion would be extremely helpful!!!
Thanks.
PS:I have a feeling that it has to do something with
sampling the trajectory of the particular joint but I am not sure how to do that.