Search Unity

Animation Clip Curves

Discussion in 'Animation' started by dibdab, Apr 18, 2017.

  1. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    how can I access the curves on animation clips?

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

    how would I get them
    clipcurves.jpg
     
  2. TrickyHandz

    TrickyHandz

    Joined:
    Jul 23, 2010
    Posts:
    196
    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:
    Code (csharp):
    1. Animator.GetFloat("Curve1")
    or
    Code (csharp):
    1. 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
     
    brokenm, GrinchyYak and Whatever560 like this.
  3. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
  4. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    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)?
    addproperty.jpg
    so this could be used to track a thing like hip movement?