Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Why can we set the curves of an AnimationClip but not be able to get them? This is troubling me.

Discussion in 'Animation' started by Unity_Nitro, Aug 24, 2023.

  1. Unity_Nitro

    Unity_Nitro

    Joined:
    Aug 27, 2022
    Posts:
    3
    I really don’t know why I can’t get the curves of a clip, but it’s giving me troubles.
    Another crazy question is: Why can’t I copy the curve(s) of an AnimationClip in the editor and paste them to an AnimationCurve property in a script?

    I ask these questions because I want to be able to take an animation clip, get the transform, rotation, and scale curves/animations, and make the properties additive in such a way that my Animator’s gameobject does not need to change its initial rotation and still perform the animation in a given direction. I believe that if I am able to get the curves of an AnimationClip, I will be able to take those and add it and orient it through script to the desired gameobject.
    I know this is complicated, because I’m having a hard time explaining it, but if you suggest that I use root motion, it will not work because then the gameobject will just perform the animation in its “forward” direction and not the direction I am inputting.
    Although it may be possible, I do not want to animate everything through code because I don’t think it would be very intuitive or easy to use, especially with what I am trying to accomplish.

    You do not have to solve my problem directly, but if there is a way to get these properties, I (and probably many others) would be glad to know.
     
  2. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    4,005
    I dont get what your issue is?
    https://docs.unity3d.com/ScriptReference/AnimationCurve.html

    Did you not read the API reference? You can very clearly add, remove, edit keys - so yeah really not sure what the issue is

    Maybe I am misunderstanding you. But if what you want is to evaluate stuff over a curve, this is what you use.

    If you are talking about curves specifically visible in the Animation window, then you need to be clearer on that as its not entirely clear and AnimationCurve is a real thing as I have pointed out, hence maybe the confusion
     
    spiney199 and Antypodish like this.