How to use Unity Animation Curves (NOT JUST ANIMATION!)

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ต.ค. 2024

ความคิดเห็น • 86

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  4 ปีที่แล้ว +10

    🌐 Have you found the videos Helpful and Valuable?
    ❤️ Get my Courses unitycodemonkey.com/courses or Support on Patreon www.patreon.com/unitycodemonkey

    • @Khoura
      @Khoura 4 ปีที่แล้ว

      Just got your course, it was awesome! Definitely going to buy more if you make them.

  • @viceroy___
    @viceroy___ 4 ปีที่แล้ว +48

    I use AnimationCurves to simulate climate, average temperatures over the year, moon phases, wind strength, blending and even keyframing the generated weather to vary rain and wind. Then I use this info to calculate dewpoint and evaluate that combined with our temperature and humidity to determine fog.
    AnimationCurves are awesome indeed.

    • @mahmutucak2293
      @mahmutucak2293 4 ปีที่แล้ว +11

      i was about to say recently i have used curves to make a blinking star effect simply by changing its size .i was really proud tough but then i see you simulate conditions of an entire planet.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว +4

      Yup, tons of awesome use cases!

    • @Prakaz
      @Prakaz 4 ปีที่แล้ว

      Not sure if sarcasm or real comment 🤔

    • @stevenbraun918
      @stevenbraun918 3 ปีที่แล้ว

      @@mahmutucak2293 :D :D

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  4 ปีที่แล้ว +18

    💬 Animation Curves are Awesome!
    Did you know you could use them for just about anything?

  • @MrCaptainbirdman
    @MrCaptainbirdman 3 ปีที่แล้ว +11

    I love how I can search 90% of unity 2d topics and Code Monkey is always there to give an informative and practical video that explains such topics :D

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +3

      Heh yeah my goal is to cover just about every topic imaginable!
      Already made 400 videos, it will be over 1000 in a few years!

    • @J3R3MI6
      @J3R3MI6 ปีที่แล้ว +2

      @@CodeMonkeyUnity absolute legend in the game dev community 🏆✨

  • @falconegaming
    @falconegaming 24 วันที่ผ่านมา

    I wanted to use animation curves for a wave spawner as well, so started searching for examples, this is perfect.

  • @YairVich
    @YairVich 4 ปีที่แล้ว +3

    I saw that animation curve in the particle system and wanted to use in normal scripts but never knew the name of it, and how usefull they are... thanks!

  • @bittenbroccoli9901
    @bittenbroccoli9901 4 ปีที่แล้ว +2

    This is a great way to get a somewhat normal distribution! If you evaluate a random float on the interval from 0 to 1 then make the curve look like a zoomed in cubic function with an origin at (.5, avg). Depending on what you are going for the extremities can be around four standard deviations from the mean.
    This can be used to determine the average health of a enemy, but give it some variety upon instantiation. A better example would probably be tree height in a well developed forest.
    Thanks for the tutorial! I would have never thought of using animation curves for other purposes.

  • @rezaanataj6978
    @rezaanataj6978 4 ปีที่แล้ว +2

    I didn't expect animation curve to be this much useful
    I'm always lazy to watch videos to learn something new in unity. But you always prove me it worth doing it ❤️

  • @wazaDev
    @wazaDev 4 ปีที่แล้ว +1

    To think I used to manually write linear equations if I wanted to scale a value over time, this is really helpful. Thanks for the video

  • @jean-michel.houbre
    @jean-michel.houbre 4 ปีที่แล้ว +3

    I already know them, but I use them quite little. Thank you for this useful video which opens up some interesting possibilities.

  • @StealthyShiroeanGames
    @StealthyShiroeanGames 10 หลายเดือนก่อน

    Wow, this video blew my mind. I never would have thought to use animation curves this way and it seems super useful! I'm excited to try this out with a future project of mine. Thanks, Code Monkey!!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  10 หลายเดือนก่อน +1

      I'm glad the video helped! Best of luck with your project!

  • @MassimoRough
    @MassimoRough 4 ปีที่แล้ว +3

    Very nice!
    Using animation curves I prefer to clamp the curve within range of [0,1] on both axes, and send/apply its evaluation to normalized values. Advantage would be simpler configuration adjustments just from the class or scriptableObject, afterall it's just the curve shape we're interested in, not the values it posses.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว +1

      I find it great that it can support both!
      I used the same values as in the logic to keep the video simple but yup if I was making this in a proper game I would probably end up normalizing the graph.

  • @drewvananne1796
    @drewvananne1796 3 ปีที่แล้ว +1

    Thanks for the awesome vid! Definitely going to start using them more! Although for your last example where you evaluate the curve at each index I would probably prefer to just make a serializable struct or scriptable object called "WaveInfo" that has an int for amount of enemies and an int for enemy health. Then you could just have a WaveInfo array on the spawner and set the stats for each wave in the inspector. I think that would feel more intuitive than matching two different curves for each wave

  • @PorcoPorchetto
    @PorcoPorchetto 2 ปีที่แล้ว

    You literally saved my game jam game, man you're THE BEST! Waiting for your Xcom game style course to grab it! Learnead a lot from your builder defender course! Keep going ^^

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว +1

      That's great! Best of luck with your Game jam entry!

  • @Oxmond
    @Oxmond 4 ปีที่แล้ว +5

    Last example is really awesome. What a great way to make fast & interesting levels! 👍🤓

  • @imdebestmoderfokingsosigin7861
    @imdebestmoderfokingsosigin7861 4 ปีที่แล้ว +1

    Thank you this is the first time I knew about animation curves I wonder why no one is talking about them they're so useful

  • @SkinnerSpace
    @SkinnerSpace ปีที่แล้ว

    Awesome tutorial! That's what I was looking for! I spent so much time writing crappy progression systems for my game and now you saved me from that!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  ปีที่แล้ว

      I'm glad you liked it, best of luck with your game!

  • @nothingatall6703
    @nothingatall6703 7 หลายเดือนก่อน

    Awesome! This is just what I needed. Thank you!

  • @AzizTheGazele552
    @AzizTheGazele552 ปีที่แล้ว

    AM SO FUCKING GLAD I CLICKED ON THIS I THOUGHT I WAS GONNA HAVE TO INTERGRATE MY ACCELERATION FUNCTION AND THEN HAVE TO REINTEGRATE EVERYTIME I WANTED TO CHANGE THE FEEL OF THE ACCELERATION CURVE. btw the shooting in ur game looks so fucking fun

  • @JMIK1991
    @JMIK1991 4 ปีที่แล้ว +3

    Yes, I have my own library to make pathfinding with it and plan to draw roads, attribute scaling... etc.

  • @dspartan007
    @dspartan007 4 ปีที่แล้ว

    Awesome, didn't know about animation curves, this opens lot of possibilities. Thanks for sharing this information friend.

  • @an9l1c1sm6
    @an9l1c1sm6 3 ปีที่แล้ว

    Thanks for this. It took me some time to adapt it to my own project, since I'm a noob. :)

  • @NameUnknown-
    @NameUnknown- 4 ปีที่แล้ว

    Oh, ive been using gradients in the way you use the curves, a lot more easy to understand with curves tbh, but i didnt know about them so... i adapted with the things i knew

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว

      Color gradients? How do you use them in the same way as Animation Curves?

  • @arcday4281
    @arcday4281 4 ปีที่แล้ว

    Cool! Especially when the video builds on previous lessons. CM - is the best !

  • @cristiano4826
    @cristiano4826 4 ปีที่แล้ว +1

    Helpful content 👍

  • @benjaminlehmann
    @benjaminlehmann 3 ปีที่แล้ว

    Great video, mate. Really helpful - just what I was looking for :D

  • @rubencrespo9699
    @rubencrespo9699 3 ปีที่แล้ว

    Thank's for the tutorial, it's awesome...

  • @highimpact1
    @highimpact1 2 ปีที่แล้ว

    Codemonkey you are the Bob Ross of unity programming.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว

      I love Bob Ross so that's quite the compliment, thanks!

  • @XRelabs
    @XRelabs 4 ปีที่แล้ว

    really awsome thank you man....you have just gave me what i need ...thank you a ton

  • @Влад-э7в2ь
    @Влад-э7в2ь 3 ปีที่แล้ว

    Awesome!! Really great tool.

  • @sidbell929
    @sidbell929 4 ปีที่แล้ว

    That is superb!

  • @varnonzero
    @varnonzero 4 ปีที่แล้ว

    I use animation curves to modify terrain generation and image filtering. I didn't even consider them for the longest time. Wish they were just called curves.

  • @alexsc7505
    @alexsc7505 4 ปีที่แล้ว

    I feel like you teach way more than my teachers

  • @watercat1248
    @watercat1248 3 ปีที่แล้ว

    I have few questions about the animetion cocurved
    1. ther is way to use one random value from my animation cocurved ? for example if want to instead i random numbers of enemies the way too the animation cocurved for this
    2. Haw to make the animetion cocurved to return to 0 wean is go to the last stage and in eny other state?
    3. Haw to stop and enable the animation cocurved?

  • @fabianobersovszky6987
    @fabianobersovszky6987 ปีที่แล้ว

    Can i use animation curves to simulate root motion? ( by copying the animations position and rotation curve to script)

  • @edbrick3368
    @edbrick3368 4 ปีที่แล้ว

    Awesome !!

  • @julianlanty2066
    @julianlanty2066 2 หลายเดือนก่อน

    I want to interpolate between 2 values using animation curves in code.
    How can I insert the maximun and minimun values through code while maintaining the curve shape made in the editor?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 หลายเดือนก่อน

      You can make the curve normalized, meaning make it go only from 0 to 1
      Then through code multiply that by some value to get it between 0 and some value. And maybe add some offset to make it between offset -> value

  • @therealmegaboi
    @therealmegaboi 4 ปีที่แล้ว

    Thanks

  • @tobiacancelliere6972
    @tobiacancelliere6972 ปีที่แล้ว

    I don't know if you or others read comments on videos this old but I was wandering something: is it possible to modify several animation curves in one window (i.e. like the curves in the animation tab)? How?
    If I find the answer before anyone reads this, I'll put it here as an edit or answer

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  ปีที่แล้ว +1

      I don't think so, at least I've never seen that being used outside of official Unity tools so I don't think that behaviour is exposed to regular users.

  • @jacobcass2447
    @jacobcass2447 4 ปีที่แล้ว

    can you make a tutorial of controlling vehicles inside unity

  • @imdebestmoderfokingsosigin7861
    @imdebestmoderfokingsosigin7861 4 ปีที่แล้ว

    I will try to make camera movement effect with animation curves when the player walk or run I will make the camera move up and down

  • @benceszekely1831
    @benceszekely1831 2 ปีที่แล้ว

    Hi, thanks for this, it was nice :)
    But I have a problem, because I created a 2D game, where I used animationClip.SetCurve() to modify my animatoins in runtime. It worked well in Editor, but when I built it to an Android phone, it didn't worked any more. Can someone help, why?

  • @watercat1248
    @watercat1248 3 ปีที่แล้ว

    I don't know in what way to use the animetion cocurved yet but thenx for the tourial the truth I knew that system existed before sew this video becuse i have see this system on meny code but i did not know how to use that system before this video

  • @2.5dboy20
    @2.5dboy20 4 ปีที่แล้ว

    Please make a tutorial on cool boss fights...like if you killed the boss it will sub divided or something or anything like that !

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว +1

      I covered a Boss Fight here th-cam.com/video/qZC1VYWnHZ8/w-d-xo.html

    • @2.5dboy20
      @2.5dboy20 4 ปีที่แล้ว

      @@CodeMonkeyUnity thanks a lot!

  • @telecomanda
    @telecomanda 4 ปีที่แล้ว

    Yep, I use animation curves for my flight "simulator".

  • @dacriaxvgr
    @dacriaxvgr 3 หลายเดือนก่อน

    I'm trying to use an animation curve to handle the headbob intensity for my game, but im having some problems setting both ends of the curve to my variables.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 หลายเดือนก่อน

      You mean it's jumping/jittery? Make sure the end point and the start point are exactly the same, also make sure there's no harsh curves between them, make them smooth

    • @dacriaxvgr
      @dacriaxvgr 3 หลายเดือนก่อน

      @@CodeMonkeyUnity Thanks! I ended up ditching that approach and I'm now using the Cinemachine noises, the Handheld Mild effect gave me what I was after :)

  • @fabianobersovszky6987
    @fabianobersovszky6987 ปีที่แล้ว

    You know how i can get the curve data from a animation clip?

  • @jhanolaer8286
    @jhanolaer8286 2 ปีที่แล้ว

    Hi sir, please also make a video tutorial of fluid simulation using a code.Thank you🙏❤

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว

      I did make that here th-cam.com/video/_8v4DRhHu2g/w-d-xo.html

  • @heavensfield494
    @heavensfield494 11 หลายเดือนก่อน

    I want rto adjust the keys value at run time but it just doesnt work, any tips?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  11 หลายเดือนก่อน +1

      That's an interesting question, I've never done it but apparently you can access the data inside the "keys" discussions.unity.com/t/altering-animation-curves-via-script/160511/3

  • @Hypocat
    @Hypocat 4 ปีที่แล้ว

    Hey, have you tested how this animation curves work on jumping?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว +1

      Sure, that's yet another valid use case! Use it to define how fast the character moves up and how fast it comes down.

  • @kamienel9941
    @kamienel9941 3 ปีที่แล้ว

    13:32 you can press A

  • @sirskyy9920
    @sirskyy9920 3 ปีที่แล้ว

    Is there a way of using Animation Curves with Post Processing Effects?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว

      Curves are just numbers so yes you can sample a point in the curve and apply it to any post processing parameter

  • @guillenoble
    @guillenoble 4 ปีที่แล้ว

    nice video

  • @third3rd216
    @third3rd216 4 ปีที่แล้ว

    Hey, I can't seem to find the link that was supposedly send to me when I created my account on your website unity code monkey.com

  • @progCan
    @progCan ปีที่แล้ว +1

    WHY DID UNITY NAME THESE *ANIMATION* CURVES INSTEAD OF JUST CURVES

  • @sheeeeshhhhh2359
    @sheeeeshhhhh2359 3 ปีที่แล้ว

    why i only have two points in curves?

  • @sauliusvincevicius8688
    @sauliusvincevicius8688 4 ปีที่แล้ว

    Me and the boys compering pp: 1:32

  • @nooxTheHumanoid
    @nooxTheHumanoid 4 ปีที่แล้ว

    Hmm

  • @mossupergamer1912
    @mossupergamer1912 4 ปีที่แล้ว +1

    first comment yayyy

  • @TheAmeer3881
    @TheAmeer3881 3 ปีที่แล้ว

    Bad design choice on unity part.
    "Animation curves can be used for much more than animations"
    Unless there is strict polymorphism, i do not see how this applies

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +1

      What? In the video I show animation curves being used for the Enemy Spawn amount which is not an animation use case. I'm not sure I understand what you mean.