Animation Clip Curves

how can I access the curves on animation clips?

is it AnimationClipCurveData.curve?
or is it ClipAnimationInfoCurve.curve?

how would I get them

For each of the curves in your animation, create a float parameter in the AnimatorController that has the same name as the curve, remember that this is case-sensitive as well. This parameter will automatically receive the curve data. Then you only need to call:
Animator.GetFloat("Curve1") or Animator.GetFloat("Curve2")
to get the current value of the appropriate curve at runtime. Unless I misunderstand what you are trying to do here. Hope that helps you out.

Cheers,
TrickyHandz

3 Likes

You can’t get curves from a clip at runtime, you can only evaluate the clip.

In the editor, you can use Unity - Scripting API: AnimationUtility.GetEditorCurve to get curves from a clip.

Thanks, guys.
I just had an idea and would be experimenting with rotating the capsule of a controller based on the animation (positioning like in rootmotion probably would not work with collisions as it is translation).

AnimationUtility.GetEditorCurve
this is obscure to me. how would I use it?

based on
public static AnimationCurve GetEditorCurve(AnimationClip clip, EditorCurveBinding binding)
and
EditorCurveBinding.path
EditorCurveBinding.propertyName

this property is the property of animation like here (the transforms of an object being animated)?


so this could be used to track a thing like hip movement?