Why Animation Curves In Unity Are So Useful

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

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

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

    The first 1,000 people to use this link will get a 1 month free trial of Skillshare: skl.sh/gamedevguide10211

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

    The AnimationCurve doesn't necessarily need a "time" value to be evaluated, you can use it to tune the glow brightness of an orb, and your epic music volume as the player gets nearer or further from the target, being "distance" what is actually evaluated. You can even use the negative values of that curve!

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

      Semantics :) Traditionally the math behind a curve uses f(t). t can be anything. I use these curves for all sorts of things. They are great anytime you want a float value based on some other factor :)

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

      @@JohnVanderbeck Naturally it is a function behind the scenes after all, but this is not that easy to get for everybody since the Unity method states "Evaluate the curve at time." and the syntax is "public float Evaluate(float time)".

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

      I don't see the point of relying on animation curves for music when there's already a bunch of audio-related curves to tweak that on the audio source itself tho

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

      @@L0upyb0y Of course there is, but it's all about maths and control. You can use a [0 to 1] range to multiply/sum the already configured sound curve. Sometimes you don't want things like background music to dim its volume depending on distance, thus the built-in curve won't do the job, or at least not good enough.

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

      @@L0upyb0y Furthermore, imagine you have a super-custom-controller script where you setup everything, except sound. So for sake of convenience you can use a curve in this script to override the one in the AudioSource so you don't have to select different GameObjects in the Inspector, but only one.

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

    One of applications is to have probability spread unevenly between 0..1 with non linear animation curve. Could be used to drop rare items much less frequently than regular ones with probability thresholds configured

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

      Ooh, this is a great one! I like it.

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

      This will save you 5 minutes in coding and will produce a ton of fidgety work, when you need to fine tune the balancing.

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

      I would not do that as it's good idea to increase chance if rare item is not dropped for a long. That's what users treat fair chance :)

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

      @@rickloyd8208 Why not both though?

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

    I used earlier this year animation curves for utility AI, I made also custom plugin to unity to generate different curve types with a press of one button that were then held in scriptable objects. Very simple, but god damn useful.

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

    In one of my latest projects, I use them to pitch the engine sound of a vehicle. This gives the player the feeling of shifting gears while having just a single one logically.

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

      Ooh using it for pitch is a nice one!

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

    WOW! I had NO IDEA this was possible! this was one of the most useful videos I've watched in a while!

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

    What beautiful video. This is my first exposure to your content, somehow... Subbed!

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

    Great video. I was very happy on the day I realized Animation Curves didn't need to be related to actual time. The little project I've been working on for the last couple of days uses multiple animation curves to control post processing settings (depth of field, desaturation, contrast, fog) based on the height of the camera above the game map. So much easier to make subtle tweaks than in code.

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

    I'm trying to find motivation to get back into programming. Looking at something like this is a reminder to just take it slow and enjoy the various new ways highly graphical interfaces such as Unity permit but don't limit the coder to. Thank you for showing yet another feature, this will absolutely come in handy for camera movement and more!

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

    I use AnimationCurve for procedural Animation like lerping between two positions or animating a step. You can also use negative values like getting the dot product of two vectors (-1 and 1) and evaluate the curve with it.

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

    What a great tutorial! For the past week I've been figuring out a way to store Xp amount and level correlation, turns out you can just create a single animation curve. Subscribing to this channel was a really great decision.

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

    I’m working on a 2D player controller and this is EXACTLY what I need. I had no idea I could do something like this. Thanks for making this video!

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

    Found this by googling how to properly use unity curves and even if I am a veteran gamedev I found your tutorial very nice. Very soothing and clear voice and good pointers all around.

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

    Oh, this is amazing, thank you! I've played around with it and now use it to generate my initial town's population based on a curve that displays their age. This is incredibly handy!

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

      Animation Curves are so versatile!

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

    I didn't even know I can use it like this, this is mind-blowing for me. I gonna play with this over weekend. Thanks

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

    Never thought we could use Animation curve in game balance & economy! Great

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

    Every time I open your channel, I can learn new things which helps a lot for my game. Thank you so much!

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

    I use Animation curves for TONS of data storage purposes.

  • @skyheart-abc
    @skyheart-abc ปีที่แล้ว

    Thank you for a useful info on how to use animation curves!

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

    This video makes my animator heart so happy. 😂
    I'm going to be adding curves to absolutely everything.

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

    I was just looking for some tips about RPG Level and Stats to be managed with the curve, so really thank you :)

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

    Helped me so much! Thanks! I was about to do some dumb complicated math.

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

    I like animation curves for adjusting noise to make terrain.

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

    This is mindblowing to me... unlocking a whole new world!

  •  2 ปีที่แล้ว

    At last, after all this time searching, I might have found my new Brackeys !
    Thanks for the videos !

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

    Really nicely taught!

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

    yeah !! a new Game Dev Guide video :D

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

    Amazing as always ! Thank you for all your tutorials :)

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

    Him: "Curves are everywhere."
    Me: "Whoa!"
    🤣🤣

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

    Awessome video! Thank you for the time and effort put into this! +1 Sub!

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

    very well made and very informative. thanks you so much for making this :D

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

    5:14 Ah, i know this feeling, "Hey, you know what'd be fun? If i made a completely useless editor button for this feature!" *spends 5 hours making an editor feature that saves me 10 minutes total* lol

  • @titanovsky
    @titanovsky 4 หลายเดือนก่อน

    Thanks!

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

    What if you took the "boring" acceleration code in the beginning. But made it using an animation curve?
    Instead of setting the speed directly with a curve. You set the acceleration.
    Why?
    Let's say you use a curve for speed aka velocity. You move forward, but you want an enemy to push you when hit.
    If you use a curve directly, this leads to JANK. He hits you and either you snap to slow or snap back.
    Or if it's curved as usual, then the curve might affect the enemy's push and it suddenly isn't consistent.
    Instead you use the curve to set the acceleration.
    You start with an acc of 5 then gradually go down to 0 the further speed gets to maxSpeed.
    This way you control how fast you start your movement, but also your maximum movement separately.
    Otherwise usually if you increase the acc, then the max speed increase as well.
    I'll have to experiment with this but it's just a thought.
    I generally avoid direct manipulation of movement as much as possible if I ever want to add interactive elements that apply force to the player.

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

    Great video mate. Thanks for sharing

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

    last one was craaaaaazzzyyyyy

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

    How did you go about solving this for the RTS camera video you had? I see you've developed the zooming in and out, with level difference here, cant figure it out from your code snippet at 3:30

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

    I'm using animation curves not just for movement, but always when I just need some interpolation.
    E.g. the smoothness of brush that paints trails on terrain when people walk on grass.

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

    Please make a video on how to plot a graph in Unity UI (like RPM/Torque) and how can we make an editor to edit this curves from UI in build game. Not in Editor

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

      Check out the UI Line Renderer video!

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

      @@GameDevGuide it doesn’t work in latest Unity and it’s not 2D I believe. And still doesn’t mention how to change AnimationCurve in Runtime

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

    Amazing tutorial thanks

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

    Hey Matt, I've been searching the web on how to make a 'News' Tab (something like the News tab in Brawl Stars or Clash Royale for example) in-game in Unity, but can't seem to find anything. Could you maybe do a tutorial on something like this?

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

    Omg that level system you've made is so OP. Is there a github with what you've just showed or everything I need to reproduce it is in the video? What did you added to use the custom buttons?

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

    This takes away much of the complexity you'd otherwise face. I used this to simulate a jetpack that would keep ascending with "inertia" by just decreasing the percentage of speed you get (and taking more time to ascend if you were descending, etc). It's awesome and hugely contributes to the game feel.

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

    The video is not beginner friendly but I get that the concept applies generally.

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

    You got a new subscriber

  • @USSR-Lenin-Stalin-Forever
    @USSR-Lenin-Stalin-Forever 4 หลายเดือนก่อน

    how to estimate time outside the curve?

  • @rahultandon9749
    @rahultandon9749 6 หลายเดือนก่อน

    0:47 programmatically making an animation curve for line of motion, speed, acceleration....how to?

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

    I thought that you would talk about Lean Curves. Maybe included in a next video!

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

    Curves are love, Curves are life

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

    Right now I'm making a whole AI for my game out of animation curves 🤖
    I use the curves to tweak AI behavior in an intuitive way, and behind the scenes convert them into actual 3-degree polynomials so I can use linear algebra and calculus to quickly evaluate complex decisions without sacrificing any accuracy

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

    Could you do a more in depth vIdeo focused on the scripting side?

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

    I think u should show full code

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

    I cannot edit the key values manually, right clicking while selecting a key gives only add key option?

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

    How can ı add animation curve for jump ? My character can't jump while ı was adding animation curve.

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

    Wow, I was just searching for using curves to affect character accel./speed but couldn't find anything. (Would there be a similar technique for affecting character's *deceleration*? After movement key is released or direction is changed for example)
    Thanks for the video!

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

      Yep, I actually do this in the video! Just sample another curve and subtract the value from your speed for the time it has not been held.

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

    Yo, can Animation curves be made to alter Wind zone floats like Turbulence? The values must be public as you can alter them in inspector

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

    Yes it's amazing!

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

    I wish my professors knew about curving 😅

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

    Last week, I used an animation curve to give my camera zoom a little bit more polish, because a linear zoom felt boring.
    I think the next step, thanks to your video, will be an acceleration curve for my camera pan speed

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

    Amazing 😍

  • @shiv-iwnl8188
    @shiv-iwnl8188 2 ปีที่แล้ว

    I used an animation curve in my procedural floating island generator to easily change the shape of my floating island

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

    I want to zoom camera with curves. Does anyone have a working code? And then in all the videos there are only code fragments, and I'm new to this business

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

    Does using this has any drawbacks in terms of performance?

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

    They should just rename it to Curve.
    Thanks for vid

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

    Could you use this for a skill system? If so, how could it be implemented?

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

    How often you make a video about the problem (smooth user experience progression) I currently face. I wish I can give you hundred of likes!

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

    I was just telling my friend that I'm too lazy for an XP function, so I just use animation curves LOL

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

    engine torque curves anyone?

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

    No need curve tho,

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

    The curves in Unity suck. They are very annoying to edit. Very bad editor usage.