Add Random "Bored" Idle Animations to Your Character (Unity Tutorial)

  Рет қаралды 30,657

Ketra Games

Ketra Games

Күн бұрын

Пікірлер: 83
@JeremiahT
@JeremiahT 2 жыл бұрын
I really appreciate how you didn't just show the final solution but the entire iteration process. I think the information sinks in better that way.
@KetraGames
@KetraGames 2 жыл бұрын
Great to hear this, thanks 😊
@dangravel2451
@dangravel2451 2 жыл бұрын
Thanks a lot for this! Everywhere I read about blending animations told me "you need to setup your blend tree, and write a script"... Gee, thanks.. We all have things we're good at, and others not so much, this aspect I hadn't a clue how to set up. Liked, subscribed.
@lorddawn3752
@lorddawn3752 Жыл бұрын
Damn that's impressive with each step explained. This should be a go-to tutorial for anyone using mecanim.
@KetraGames
@KetraGames Жыл бұрын
Thank you 😊
@hefferwolff3578
@hefferwolff3578 2 жыл бұрын
This was so good, thanks so much!
@KetraGames
@KetraGames 2 жыл бұрын
Thanks, glad it was useful 😊
@wangyangshi
@wangyangshi 10 күн бұрын
your videos are very clear to new learners, very great videos!
@KetraGames
@KetraGames 9 күн бұрын
Thanks, we appreciate this comment 😊
@rachapongwatana3868
@rachapongwatana3868 Жыл бұрын
Thank you so much for sharing how to play with NPC Behavior with some random animation, Awesome tutorial !
Жыл бұрын
Just best animation tree tutorial on YT, I wish Narasimha bless your life and protect your family!
@KetraGames
@KetraGames Жыл бұрын
Thanks for this comment
@evil_beast_z
@evil_beast_z Жыл бұрын
ur Hi guys gives me a relief
@JermsKylefilms
@JermsKylefilms 7 ай бұрын
love this video so much, not ashamed to say ive forget like 3 times and had to come back but thanks for this lol.
@MickyMiniAdventures
@MickyMiniAdventures Жыл бұрын
Thank you for your awesome tutorials. Your tutorials are very clean and easily understandable it's saves a lot of time. You are an inspiration to the female developers
@donpapamendez2352
@donpapamendez2352 2 жыл бұрын
Thanks for the tutorial, you are too good. you have a new subscriber
@KetraGames
@KetraGames 2 жыл бұрын
Thanks for your support 😊
@amcmahon134
@amcmahon134 2 жыл бұрын
Hi, this tutorial series has been super well done and helpful! Are you planning to cover water/swimming at some point in the future?
@KetraGames
@KetraGames 2 жыл бұрын
Thanks. Yes, water, swimming and diving are on our list for future videos.
@mikehallvideos
@mikehallvideos 2 ай бұрын
This really really helped me out. Thank you!!!!!
@KetraGames
@KetraGames 2 ай бұрын
Great to hear, thanks 😊
@Tenzordk
@Tenzordk 2 жыл бұрын
And my enemy's idle is done! - Thanks! :D
@KetraGames
@KetraGames 2 жыл бұрын
Great 👍😊
@evanlegrand874
@evanlegrand874 2 жыл бұрын
Such an awesome tutorial, thanks!
@KetraGames
@KetraGames Жыл бұрын
Thanks very much for this comment 😊
@ani-gamer320
@ani-gamer320 2 жыл бұрын
Thanks again ❤️❤️❤️
@KetraGames
@KetraGames 2 жыл бұрын
👍😊
@IslamAudioStation
@IslamAudioStation Жыл бұрын
not the easiet method but it works. well done.
@KetraGames
@KetraGames Жыл бұрын
In hindsight, this maybe wasn't the easiest approach. Perhaps a Direct Blend tree would have worked better. One to revisit in future 😊
@ObiWineKenobi
@ObiWineKenobi 9 ай бұрын
Thank you! This worked great!
@KetraGames
@KetraGames 8 ай бұрын
Great to hear, thanks 😊
@MVAgustaBrutale1000RR
@MVAgustaBrutale1000RR 11 ай бұрын
You are the best override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { int randomClip = Random.Range(1,4); animator.SetFloat("Rise",randomClip); }
@combobreaker9618
@combobreaker9618 Жыл бұрын
It works for me, but the counter on the float parameter "Bored Animation" keeps going down till values like -1.662e-44, and I can't get it to round 0. Any idea on what's causing that?
@KalponicGames
@KalponicGames Ай бұрын
You can create a preset to apply the settings faster. I think you already know it.
@seyfo.03
@seyfo.03 Жыл бұрын
It works very well, just the last animation will play on loop for a couple times. I don't understand why, any ideas?
@nikobellic7455
@nikobellic7455 2 жыл бұрын
Why not use a sub-state machine? I have used animation sub-state for things like that and it was super easy to implement. Unless I am unaware of the benefits of using blend tree for this use case.
@KetraGames
@KetraGames 2 жыл бұрын
Hi, we originally thought that a sub-state machine would be the way to go with this as well. When we started to explore this though, there doesn't seem to be a way to transition from any state in the sub-state back to a state in the base layer. So you have to add a transition from every idle animation in the sub state to Jump in the base layer and to Move in the base layer. If you were to add other states from Idle such as Crouch, Pull Lever, etc. then you would have to duplicate these transitions as well. By using a Blend Tree we only have one state for Idle so we only have to set up and maintain one set of transitions. If you've found an easier way to do this using a sub-state machine then it would be really great to hear how you did it 😊
@nikobellic7455
@nikobellic7455 2 жыл бұрын
@@KetraGames I see your point now. My project was fairly small, so I didn't have many transitions from idle. Thanks for your tutorial, learned something new.
@K3NZ
@K3NZ Жыл бұрын
The stateInfo Normalized time is going up more than 1, what to do to fix the problem ?
@pushingpandas6479
@pushingpandas6479 2 жыл бұрын
this character is sooo cute
@KetraGames
@KetraGames 2 жыл бұрын
😄😄
@ivyxu5222
@ivyxu5222 Жыл бұрын
Hi, thank you so much for making this video! I'm using this approach on a 2D animation. There are two idle animations, and there isn't the need for blending. However, when I set the waitTime to 5 or 6 seconds, the trigggered idle animations never play from the start or play till the end -- there are always some frames cut off. I have a feeling it has to do with the normalizedTime comparison, but I don't know how to fix this. Any hints or leads on this?
@krawper
@krawper Жыл бұрын
Same problem as you, for a 2D character. I've been trying to find a solution since yesterday to fix this error, but it's difficult.
@ivyxu5222
@ivyxu5222 Жыл бұрын
@@krawper my work around was to set the waitTime to 6s, which for me had the minimal cut off, and then extended the beginning of one idle animation with extra blank frames so the important part doesn’t get removed
@jussirautiainen7772
@jussirautiainen7772 Жыл бұрын
This set up does not work ... if I use my own animations then the stateInfo.normalizedTime starts counting at 0.75 and never at 0 ... so the transitions play for a split second and return to the 0 state ...
@ColtPtrHun
@ColtPtrHun 2 жыл бұрын
In my understanding, blendtree is for mixing animation clips, not select one of them. I think a Sub-State Machine (or a new animation layer maybe) would be a better fit.
@KetraGames
@KetraGames 2 жыл бұрын
Hi, you're absolutely correct in that this isn't the intended use case for a blend tree. We tried using a sub state machine first but you can't transition from any state in the sub state machine, so you end up having to add transitions from every bored animation and it becomes difficult to manage. Layers might be a better way to go though. We'll have a play and possibly redo this video if we find a better way 😊
@ColtPtrHun
@ColtPtrHun Жыл бұрын
@@KetraGames I see, you're right.. Since then I ran into the same problem with subtrees. I was thinking about using an empty state which would gather the transitions, and go to idle states from there, but that may would mess up the transitions.
@ColtPtrHun
@ColtPtrHun Жыл бұрын
@@KetraGames Also, moving these animations to a new layer feels a bit awkward, since these animations belongs to the same layer and what if I want to use custom transitions to-and-from the blendtree etc... It seems like blendtree is the way to go! Thank you for your answer 🙂
@KetraGames
@KetraGames Жыл бұрын
@@ColtPtrHun Hi, we've thought of some other options since that may be easier that you may want to try. A direct blend tree might be able to get past some of the complication brought about by using the 1D blend tree. Another option, which is probably the easiest depending on how your scripts are set up, would be to switch animation states in the scripts rather than using the transition states in the animator, using docs.unity3d.com/ScriptReference/Animator.CrossFadeInFixedTime.html
@DenysAlmaral
@DenysAlmaral Жыл бұрын
@@KetraGames CrossFade is the way
@zachwang6156
@zachwang6156 Жыл бұрын
Love the tutorial! I followed the steps exactly but when I finished with the coding aspect and went into Unity to change the "Time Until Bored" I don't have the option to and instead there's an error message reading "Please fix compile errors before creating new state machine behaviours". What does that mean and how can I move forward?
@KetraGames
@KetraGames Жыл бұрын
Hi, are there any errors in the console window?
@you_what319
@you_what319 Жыл бұрын
Curious, I've taken the +1 out of the Random.Range, changed numberOfBoredAnimations to numberOfIdleAnimations and set that to 4 in the inspector, this way makes more sense to me and has the same results. Is their anything wrong with this method that I don't see? Thanks again for another brilliant tutorial.
@KetraGames
@KetraGames Жыл бұрын
Hi, that should work just fine. Whichever way makes the most sense to you 😊
@you_what319
@you_what319 Жыл бұрын
Thankyou Ketra, so far so good, I've not long finished this series and have gained a wealth of knowledge and have a solid starting point for my new Project. Much appreciated. Your style is so much easier to follow along.
@hmbullen
@hmbullen 2 жыл бұрын
Thanks for the tutorial! Could you use a 2D freeform blend tree rather than the 1D? Avoid having the multiple idle states in the blend tree to revert back too...
@KetraGames
@KetraGames 2 жыл бұрын
Hi, thanks for the suggestion. A 2d blend tree may work better or perhaps a direct blend tree 🤔. We'll have a play and may do a version two of this video if we find anything better
@forcepower7116
@forcepower7116 2 жыл бұрын
Hey, so sometimes when stopping to move it plays one of the bored animations. Is that supposed to be ? Because I thought it would only play them after we are idle for long enough
@KetraGames
@KetraGames 2 жыл бұрын
Hi, it shouldn't go straight into a bored animation. We ran into this problem when we were doing some testing for this video, and the problem was the order of the animations in the Blend Tree. Check that you have them in the following order. Breathing Idle, Bored, Breathing Idle, Shuffling, Breathing Idle, Offensive Idle. Hope that helps 😊
@marhirari
@marhirari Жыл бұрын
i'm already using a blend tree for idle, walk and run animation, how do i connect this one to the old one?
@KetraGames
@KetraGames Жыл бұрын
Hi, you would connect the two blend trees with a Transition that goes from the idle blend tree to the movement one when there is movement input and then another transition that goes back again when there is no input. Hope that helps 😊
@yaxees349
@yaxees349 2 жыл бұрын
hi, when enemy tutorial?
@KetraGames
@KetraGames 2 жыл бұрын
Hi, we're hoping to start looking at enemy AI soon 😊
@penitentgames
@penitentgames Ай бұрын
Why not use a substate machine for this? Then you don't need to mess with interlacing the default idle animation between the others and can control/finetune the transition between idle animations.
@KetraGames
@KetraGames Ай бұрын
Hi, that does seem like the most obvious solution, and the route we first tried with this. Unfortunately we couldn't find a way of exiting the idle substate machine when conditions were triggered regardless of the internal state. For example when the jump is triggered you would want to be able to exit the idle substate machine and go to the jump state. The only way we found to make this work was to add transitions from all the states in the substate machine to the jump state in the base state machine, meaning you still have to duplicate all the transitions. If there's a way to make this work then we'd love to know because it would make this a lot easier 😊
@onursevinc6840
@onursevinc6840 2 жыл бұрын
🔥🔥🔥
@KetraGames
@KetraGames Жыл бұрын
👍😊
@zendraw3468
@zendraw3468 2 жыл бұрын
why dont you make a discord server
@khnuxsora
@khnuxsora Жыл бұрын
Hey, can I use this in a 2D game?
@KetraGames
@KetraGames Жыл бұрын
Hi, you should be able to use the same principle in a 2D game 😊
@khnuxsora
@khnuxsora Жыл бұрын
@@KetraGames Thank you for the reply! 😄
@deathstroke2877
@deathstroke2877 2 жыл бұрын
I need help xD. My player has autismus now.
@KetraGames
@KetraGames 2 жыл бұрын
Hi, what's going wrong? The full script is available here so you can compare with what you have - dotnetfiddle.net/ANF7BZ. I'd also check that the animations are in the correct order in the blend tree and have the correct thresholds. Hope that helps 😊
@deathstroke2877
@deathstroke2877 2 жыл бұрын
@@KetraGames My idle animation playtime is too short, i guess.
@bunzy5279
@bunzy5279 2 жыл бұрын
Could you also do on player input, end bored?
@KetraGames
@KetraGames 2 жыл бұрын
Hi, if you start moving the animation will switch to running. Do you mean for other input?
@bunzy5279
@bunzy5279 2 жыл бұрын
@@KetraGames I was thinking along the lines of idle timer into an idle animation (say a sleep) then it wont change the new idle animation until we receive player input. If you've played hollow knight its like how the bench idle animation plays if that makes any sense.
@KetraGames
@KetraGames 2 жыл бұрын
@@bunzy5279 Ah, I see what you mean. Yes you could do a similar thing but just don't revert back to the original idle animation
@bobdawkins7473
@bobdawkins7473 8 ай бұрын
Wouldn't recommend this method in real (Depending on what your game is) because you'd want to use layering. This method is hard 1 to 1 and can't be called from other states in this setup.
@PranjayMittal
@PranjayMittal 2 жыл бұрын
Thanks. Im using unreal but I couldn't figure out how to actually do it
@darrylswims8721
@darrylswims8721 2 жыл бұрын
😏 ᴘʀᴏᴍᴏsᴍ
@486x
@486x Жыл бұрын
totally USELESS
Improving Ragdoll Physics (Unity Tutorial)
12:48
Ketra Games
Рет қаралды 10 М.
Injured Animations using Layers (Unity Tutorial)
13:43
Ketra Games
Рет қаралды 22 М.
Ouch.. 🤕⚽️
00:25
Celine Dept
Рет қаралды 15 МЛН
Mom had to stand up for the whole family!❤️😍😁
00:39
Sigma baby, you've conquered soap! 😲😮‍💨 LeoNata family #shorts
00:37
Escaping Unity Animator HELL
18:18
Lost Relic Games
Рет қаралды 512 М.
Creating a Day/Night Cycle (Unity Tutorial)
20:28
Ketra Games
Рет қаралды 43 М.
Animated Character Jump (Unity Tutorial)
16:03
Ketra Games
Рет қаралды 82 М.
How to use Animation Transitions (Unity Tutorial)
9:59
Ketra Games
Рет қаралды 181 М.
Why you Draw Bad Assets || 2D Game Art
13:00
Nonsensical 2D
Рет қаралды 76 М.
Stand Back Up! How to Reverse Ragdoll Physics (Unity Tutorial)
25:37
How to Start Gamedev in 2024
10:28
Sasquatch B Studios
Рет қаралды 572 М.
How to play random animations [Unity Tutorial]
7:36
Comp-3 Interactive
Рет қаралды 22 М.
Animator Transition Interrupt Sources, Explained | Unity Tutorial
10:01
Ouch.. 🤕⚽️
00:25
Celine Dept
Рет қаралды 15 МЛН