Тёмный

Complex Animations made Simple with Blend Trees! 

Code Monkey
Подписаться 544 тыс.
Просмотров 42 тыс.
50% 1

Learn to use Animator Blend Trees to simplify your complex Animations!
🌍 Get my Complete Courses! ✅ unitycodemonke...
👍 Learn to make awesome games step-by-step from start to finish.
Interested in a Complete Visual Scripting Course?
unitycodemonke...
Character Controller in Unity 2D
• Character Controller i...
🌍 Get Code Monkey on Steam!
👍 Interactive Tutorials, Complete Games and More!
✅ store.steampow...
If you have any questions post them in the comments and I'll do my best to answer them.
🔔 Subscribe for more Unity Tutorials / @codemonkeyunity
See you next time!
📍 Support on Patreon / unitycodemonkey
🤖 Join the Community Discord / discord
📦 Grab the Game Bundle at unitycodemonke...
📝 Get the Code Monkey Utilities at unitycodemonke...
#unitytutorial #unity3d #unity2d
--------------------------------------------------------------------
Hello and welcome, I am your Code Monkey and here you will learn everything about Game Development in Unity 2D using C#.
I've been developing games for several years with 7 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.
You can see my games at www.endlessloopstudios.com
--------------------------------------------------------------------
Website: unitycodemonke...
Twitter: / unitycodemonkey
Facebook: / unitycodemonkey

Опубликовано:

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 95   
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
🌐 Have you found the videos Helpful and Valuable? ❤️ Get my Courses unitycodemonkey.com/courses or Support on Patreon www.patreon.com/unitycodemonkey
4 года назад
Yep, there you go!
@donkeymonkey4435
@donkeymonkey4435 3 года назад
I Hope One day, This channel Will be regarded as Great as Brackeys Even Though Brackeys left the RU-vid, He Lives in our Each Line of Code!
@CodeMonkeyUnity
@CodeMonkeyUnity 3 года назад
I'd love to one that reach that height! I'll certainly keep trying!
@LordPigu
@LordPigu 8 месяцев назад
You speed up my game dev learning so much and I cant thank you enough.
@daxdmon3297
@daxdmon3297 4 года назад
Hope to see a 3D Movement Blend Tree. But, really great work. Thank You for giving a starting point to Blend Trees
@algs5483
@algs5483 4 года назад
Congrats on almost 200k!
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
Almost there!
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
💬 Combine tons of animations easily with Blend Trees! Super useful! Interested in the Visual Scripting course? Click here! 🌐 unitycodemonkey.com/interestedvscourse.php
@varunsha
@varunsha 4 года назад
For some days I was thinking why my animator looks messy now I got it how to make it look clean thanks code monkey ☺️👍
@yesyoutooo8842
@yesyoutooo8842 4 года назад
Thanks for all the tutorials! You could make another blend tree video where you show how you can use blend trees to play the right animation based on your current mouse position. So if your cursor is to the top right of you and you press the attack button you play the attack top right anim. Surely would help a lot of people doinf 2d top down! I had a lot of trouble getting that work for the first time.
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
The logic for the animator is the same, the animator doesn't care where the horizontalMovement and verticalMovement parameters came from. If you use the direction vector towards the mouse instead of the movement vector, everything will work the same. I covered a mouse based combat system like that here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-AXkaqW3E9OI.html
@WagnerGFX
@WagnerGFX 3 года назад
8:20 You just nailed the beat 'em up style😄
@roshanthapa1297
@roshanthapa1297 3 года назад
That was smooth player controller script with animation for most 2d game. 👍
@SmartPenguins
@SmartPenguins 4 года назад
Nice, like always!
@jud.su.5developer895
@jud.su.5developer895 Год назад
There no ads in your video add some . RU-vid now it’s full of ads .make some ads .it’s good for your channel 👏🏻
@jud.su.5developer895
@jud.su.5developer895 Год назад
Thank you ❤❤
@dspartan007
@dspartan007 4 года назад
Excellent video, thanks for sharing.
@chocobo678
@chocobo678 4 года назад
I'm trying to build a more code oriented animator to avoid a transition hell, do you think blend trees are a better approach than force Play a state through code? As always, thanks for the top notch content
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
Blend trees really help cut down the number of transitions required so they should help you avoid transition hell. Also you can put blend trees inside blend trees. By doing Play() through code it seems like it will end up just as messy but keep the mess in the code instead of the animator. It's always tricky to handle tons of animations so try many things until you find the best approach for your case!
@chocobo678
@chocobo678 4 года назад
@@CodeMonkeyUnity you're totally right.
@Oxmond
@Oxmond 4 года назад
Blend Trees are awesome! 👍🤓🧡
@davidvarga2916
@davidvarga2916 4 месяца назад
I have a sword slash animation. It just rotates the sword with a bit of positioning. When I drag the mouse over the frames slowly all is good, but when I hit play it skips random frames in the middle of the animation. Looks terrible when using it with a trail renderer. Any ideas why?
@WorldEnder
@WorldEnder 4 года назад
hey there, @codemonkey! I'm currently trying to watch your vids about mesh animations and your guest spritesheets but somewhere down the line (after you show how to draw the uvs and how to create a random guest), I get lost, I cannot find the how to animate video (it seems only part one of 2 is available) :). If noone can point to that video on your playlist, will you show us how you create the sprite animations you mentioned in this video? maybe in your future course, cheers !
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
For making sprite based animations you just draw the sprites and then in Unity you slice the spritesheet. I'm not good at drawing so I don't have any drawing tutorials but there's tons on RU-vid. Drawing for games and drawing for anything else is the same.
@isaiahwilliams1520
@isaiahwilliams1520 Год назад
How come you attached the Animator component to the parent obj but it still affects animations for child obj (sprite)? mine isn’t behaving the same way. I’m trying to apply this method in a 3D project if that clears anything up.
@isaiahwilliams1520
@isaiahwilliams1520 Год назад
My sprite renderer component is attached to my child object (sprite) and my animator component is attached to the parent object.
@cybertech1076
@cybertech1076 Год назад
This works if I only wanted to animate the gun in the hand of a first-person player when they move with the gun right?
@CodeMonkeyUnity
@CodeMonkeyUnity Год назад
Sure, you can blend any animations you want, so you could have animations for the gun swaying in different directions
@klausology8285
@klausology8285 4 года назад
Hello Mr Code Monkey! Am loving your videos very much. I have always found them to be extremely helpful. Would you consider making a video regarding Unity's Animation C# Jobs system?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
I've made a bunch of videos on the Job System a long time ago but haven't touched DOTS in a while. After I'm done with the course I definitely want to go back to it and see what changed!
@klausology8285
@klausology8285 4 года назад
@@CodeMonkeyUnity Ahh yes! I actually learnt how to do DOTS stuffs by watching only your videos and nothing else! Your videos made the entire learning process easy and painless. Unity did release an animation C# Jobs system (blogs.unity3d.com/2018/08/27/animation-c-jobs/), but alas, there appears to be not much tutorials about this on youtube. Alright! Will be looking forward to your videos as usual! Cheers.
@awesomegamedev
@awesomegamedev 4 года назад
May I be curious, why did you decide to drop your standard intro?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
I was experimenting with seeing what a shorter intro would do to the average view duration but haven't analyzed those results yet.
@awesomegamedev
@awesomegamedev 4 года назад
@@CodeMonkeyUnity I am really curious how it turns out:) To be honest, I think your standard 30 second intro is too long, but statistics would be more objective.
@KalponicGames
@KalponicGames 4 года назад
Hi do we need separate sprites to set up blend tree for left and right movement? Then it's more work for the artist 😅
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
You can use the SpriteRenderer Flip X to turn a Right sprite into Left
@KalponicGames
@KalponicGames 4 года назад
@@CodeMonkeyUnity Nah that is not useful I want o flip all the child objects too.
@kazru7703
@kazru7703 3 года назад
Hello Sir , I saw your Bottom-Right corner have a preview space,and i want to know how to do it. Is it a package?
@CodeMonkeyUnity
@CodeMonkeyUnity 3 года назад
It's just the inspector window, when you select a blend tree it shows a preview
@kazru7703
@kazru7703 3 года назад
@@CodeMonkeyUnity Oh, I did not know that. Thanks for the answer.
@jeromej.1992
@jeromej.1992 4 года назад
Is it intentional that u never set the horizontal/vertical animator parameter to 0 so the idle position matches the last direction? Or would Unity remember the last one active if values are all 0.
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
The parameters are only set when the character is moving so when the character stops moving the parameters keep their state for the last move direction
@tauheedgamedev2388
@tauheedgamedev2388 4 года назад
Nice. 👍
@YoonutzBv
@YoonutzBv Год назад
Can you recommend me a way to help me work with Blend trees and animation swap? I am struggling to find a tutorial for my frame by frame animation game sprite sheet animations. Everything that I have seen so far, don't work with Blend trees
@CodeMonkeyUnity
@CodeMonkeyUnity Год назад
You can't blend sprite sheet animation, you can't automagically blend 2 sprites together, so you can only use blend trees to do what I'm doing here, define the animations and instantly change between them without any blend.
@YoonutzBv
@YoonutzBv Год назад
Thank you for the replay. I have one last question, for your character animation movements. Did you used any Animation Clips or everything is done in code in any of your videos? Because I do not recall seeing any video from you where made the animation movements for all of the directions, for your characters. Would you mind pointing if out, if it is one available ?
@MrElderlee
@MrElderlee 4 года назад
Awesome.
@benedek02
@benedek02 3 года назад
Hi, how can you manage all of body patrs with a single object?
@CodeMonkeyUnity
@CodeMonkeyUnity 3 года назад
With the Unity Animation System you cant, each body part needs its own object. That the main limitation that made me build my own animation system ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-11c9rWRotJ8.html
@gorillagamer5121
@gorillagamer5121 3 года назад
Dont mind me telling but could you pls change your site. Some more color would make it a lot more interesting thank you for the video though:)!
@galrose7165
@galrose7165 4 года назад
And.. yep! There you go!
@vergilw7009
@vergilw7009 3 года назад
Please let me know, this Blend Trees system is a new function ??? I`ve watch a lot of Tutorial for player movement, but none of them showing this "Blend Trees"
@CodeMonkeyUnity
@CodeMonkeyUnity 3 года назад
It's been around for several Unity versions, it's the main way to organize complex animations
@wafflegamerxox6575
@wafflegamerxox6575 3 года назад
The brackeys of 2D games
4 года назад
O que faltou aqui foi adicionar outra camada com a animação de combate fazendo "blend" com a animação de idle ou de movimento. Não lembro como se fala "idle" e "blend" em Português :-/
@chocobo678
@chocobo678 4 года назад
Idle = Ocioso Blend = misturar/combinar
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
No curso eu uso outra Blend Tree para o Attack e a unica coisa diferente é a transition que é feita usando um parameter trigger.
@AliHaider-jy1pr
@AliHaider-jy1pr 3 года назад
How to create suprite and also a 2D character.
@CodeMonkeyUnity
@CodeMonkeyUnity 3 года назад
You can draw using any image program like Photoshop or GIMP or Paint
@AliHaider-jy1pr
@AliHaider-jy1pr 3 года назад
Yes but i am confusing how to animate character mean making animating sprites .
@bobmcbob4399
@bobmcbob4399 3 года назад
for isIdle comparing float variable with exact zero is a no-no. You should reform the state check to use > and a very small number close to zero like 0.1f . This would be: isIdle = (moveX < 0.1f) && (moveX > -0.1f) && (moveY < 0.1f) && (moveY > -0.1f)
@CodeMonkeyUnity
@CodeMonkeyUnity 3 года назад
The value comes straight from the input, there's no math applied to it so you can safely compare directly with 0. floats only become inaccurate when you start doing math
@bobmcbob4399
@bobmcbob4399 3 года назад
@@CodeMonkeyUnity ok cool, thanks for the replies
@davef101
@davef101 4 года назад
Always use Animator.StringToHash. eg. animator.SetFloat( Animator.StringToHash( "horizontalMovement" ), moveDir.x ); Or define the Animator.StringToHash( "horizontalMovement" ) as a const int. This is a way faster operation.
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
Sure, if speed is a concern you can make it faster. But don't bother with overengineering if it's not necessary.
@davef101
@davef101 4 года назад
@@CodeMonkeyUnity Sure, that's a fair comment. But, coding practices like these are highlighted to our Junior Devs as soon as they arrive at our studio and I think it's a good discipline to have. When working on large scale projects, things like this add up.
@jeromej.1992
@jeromej.1992 4 года назад
I reckon not everyone can afford ReSharper, but if you do and install the ReSharper for Unity's extension, it suggests to do the modification for you automatically. I've personally never been taught it but if ReSharper suggests it to me, I don't need to remember it.
@denisgoodman4492
@denisgoodman4492 4 года назад
Why did you use Update() for Rigidbody.velocity() vs FixedUpdate()&
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
Setting the rigidbody.velocity doesn't directly move the Rigidbody, it just sets the velocity and then on the next FixedUpdate() the Physics system applies that velocity.
@denisgoodman4492
@denisgoodman4492 4 года назад
​@@CodeMonkeyUnity Can be it spread more widely - if we change properties of Rigidbody - it can be did in Update() (or must be made in Update())? And if we use some methods Rigidbody it must be did in FixedUpdate()? Always?
@bobmcbob4399
@bobmcbob4399 3 года назад
Why not add a multiplication (for each case in X and in Y direction) with Time.Delta to make your movement code frame rate independent also?
@CodeMonkeyUnity
@CodeMonkeyUnity 3 года назад
The movement is handled by the rigidbody velocity which already handles deltaTime
@imdebestmoderfokingsosigin7861
@imdebestmoderfokingsosigin7861 4 года назад
2d topdown fans has entered the chat
@superdavisdon3791
@superdavisdon3791 4 года назад
I might be using bend trees like every Unity game developer. 🙄😄👍
@RavenCroftLoft
@RavenCroftLoft 3 года назад
You should make a video like this without using transitions and keeping right to the code.
@CodeMonkeyUnity
@CodeMonkeyUnity 3 года назад
If you're not using transitions you're giving up one of the best things about the animator.
@RavenCroftLoft
@RavenCroftLoft 3 года назад
@@CodeMonkeyUnity Your the only person that ive seen mention that honestly. Everyone i've talked to has been kind of against it since it can cause issues with animation transitions overlapping. Is this not the case?
@CodeMonkeyUnity
@CodeMonkeyUnity 3 года назад
@@RavenCroftLoft It can definitely become messy if you abuse it but thats not a reason to disregard the feature alltogether. Just organize your States better, use Blend Trees, use Sub States, etc.
@MarushiaDark316
@MarushiaDark316 3 года назад
Would be curious to hear what you think of this idea about eliminating Animator trees altogether and just doing everything through code: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-nBkiSJ5z-hE.html
@sannanch7564
@sannanch7564 4 года назад
Please define everything man please.....
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
Define what?
@thatoneothergamer6158
@thatoneothergamer6158 2 года назад
...this is very useful, shit
@themerpheus
@themerpheus 4 года назад
This is not a very useful feature. Animator blend trees are horrible comparing to other engines. 2D blend map thing is very bad. Unity should refine this imho.
@CodeMonkeyUnity
@CodeMonkeyUnity 4 года назад
What's bad about it?
@jeronimocollares320
@jeronimocollares320 2 года назад
Zero 'complex' in this tutorial. Just bait...as usual.
@CodeMonkeyUnity
@CodeMonkeyUnity 2 года назад
The blend tree helps you easily manage complex animations, like managing left-right-up-down animations If you've ever tried manually doing your own state machine to manage left-right-up-down animations you would see just how complex it actually is and just how much simpler the blend tree makes it. What do you understand by complex? What did you expect based on the title?
@jeronimocollares320
@jeronimocollares320 2 года назад
@@CodeMonkeyUnity ... ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-QVxvwRAYeHU.html
@CodeMonkeyUnity
@CodeMonkeyUnity 2 года назад
@@jeronimocollares320 What? Sounds like you're confusing animations and a character controller. Those are completely separate things. This video is explaining how animator blend trees work, those have nothing to do with a character controller. If you're looking for a character controller then yeah this is not the right video, look at this one instead ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-jXz5b_9z0Bc.html
@jeronimocollares320
@jeronimocollares320 2 года назад
@@CodeMonkeyUnity yes... and you confuse tutorials with BAIT to promote your courses, Bye!
@jeronimocollares320
@jeronimocollares320 2 года назад
@@CodeMonkeyUnity ...plus, I'm always suspicious of those 'well-intentioned' who try to 'privatize' knowledge or treat something in the public domain as 'private'... easy to understand the reasons why you discredited a video and the ideas of a guy who criticized Unity's mercenarism days ago...
Далее
2D Animation with Blend Trees Unity Tutorial
19:53
Просмотров 35 тыс.
Grand Final | IEM RIO 2024 | BO5 | КРNВОЙ ЭФИР
6:35:24
The Obscure Lore Of Zig And Sharko
20:43
Просмотров 285 тыс.
I Made the Same Game in 8 Engines
12:34
Просмотров 4,1 млн
Escaping Unity Animator HELL
18:18
Просмотров 511 тыс.
Simple Wind Shader Effect in Unity!
13:52
Просмотров 79 тыс.