Knockback NavMeshAgents using Physics | AI Series 51 | Unity Tutorial

  Рет қаралды 4,288

LlamAcademy

LlamAcademy

Күн бұрын

Go to this video's Sponsor: snhu.edu/llamacademy to see what the current average annual salary for a game developer programmer is and learn how you can get started!
In this tutorial you'll learn how to combine the Unity Physics system and the NavMeshAgent to apply realistic knockback forces to the NavMeshAgents!
👨‍💻 As always, all code from this video is available on GitHub: github.com/llamacademy/knockb...
🏷️Save 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: www.jetbrains.com/store/?sect...
📚 Resources:
⚫ Gun Series Playlist: • Scriptable-Object Base...
⚫ AI Series Playlist: • AI Tutorial Series in ...
⚫ OnCollisionEnter Docs: docs.unity3d.com/ScriptRefere...
⚫ Collision.impulse Docs: docs.unity3d.com/ScriptRefere...
⚫ Shooting with the Gun System: • Shooting, Simple Sprea...
⚫ NavMeshAgent Avoidance: • NavMeshAgent Avoidance...
🧡 Believe in LlamAcademy's mission and have received value from the videos? Here's how you can show your support:
📚 Take my Unity ShaderGraph Course:
www.gamedev.tv/p/unity-shader...
Become a Supporter:
🌟 Patreon: / llamacademy
🌟 KZbin Member: / @llamacademy or click the Join button on any video
🌟 GitHub Sponsor: github.com/sponsors/llamacademy
Use these affiliate links to do your Asset Store / Humble Bundle Shopping!
💸 Check out the latest Humble Bundles www.humblebundle.com/software...
💸 Publisher Sale! 50% OFF an entire publisher's Assets! Publisher changes weekly! assetstore.unity.com/publishe...
💸 Save up to 50% on NEW Assets: assetstore.unity.com/?new_sal...
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
#unitytutorial #tutorialtuesday #gamedev #tutorial #unity #llamacademy #gamedevelopment #ai
Chapters:
00:00 What to Expect
02:17 Enemy Configuration
05:08 Sponsor: Southern New Hampshire University
06:30 Knockback interface - IKnockbackable.cs
07:00 Apply Knockback on IKnockbackables - GunScriptableObject.cs
10:03 Quickly Review EnemyMovement.cs
10:58 Get Knocked Back - EnemyMovement.cs
14:42 Demo 1
15:06 Polishing the Effect - EnemyMovement.cs
16:20 Chain knock backs! - KnockbackOnCollision.cs
17:32 Add KnockbackOnCollision to Prefab & Final Demo
17:55 Final Considerations, Closing Thoughts, & Support LlamAcademy

Пікірлер: 35
@castlecodersltd
@castlecodersltd 27 күн бұрын
I've really enjoyed this series, thanks :-). It's answered some questions I've had, not just for AI.
@tianbornman6115
@tianbornman6115 3 ай бұрын
Dude, legit exactly what i was looking for, i was tryna make this work for a while. TY!
@breadman7733
@breadman7733 4 ай бұрын
Another amazing video. Thanks Liam !
@mohokhachai
@mohokhachai 3 ай бұрын
Thanks for the tutorial
@LlamAcademy
@LlamAcademy 3 ай бұрын
🙏
@janowazir
@janowazir 4 ай бұрын
Thanks for making this video
@LlamAcademy
@LlamAcademy 4 ай бұрын
Welcome ☺
@janowazir
@janowazir 4 ай бұрын
@@LlamAcademy You also.
@brbdennis5317
@brbdennis5317 4 ай бұрын
Chris the legend! 😎
@degiguess
@degiguess 4 ай бұрын
One thing that's worth noting if you feel like it would suit your project is that you can actually calculate a path on a navmesh without having to use a navmesh agent. In my project I got annoyed by the lack of physics on agents and ended up just making my own physics based agent. It's as simple as calculating a path, getting the next point in the path, applying a force to make my agent face it, then applying a forward force to push the agent along.
@TheArghnono
@TheArghnono 4 ай бұрын
How many knocks would an IKnockbackable knock back if an IKnockbackable could knock back? A great video tutorial! I had a similar problem a year or so ago and had no ends of pain since I didn't know Agent.Warp existed. RTFM, I know.
@LlamAcademy
@LlamAcademy 4 ай бұрын
😆
@PRodi_
@PRodi_ 4 ай бұрын
Awesome tutorial, as always! Your dedication to these guides is truly inspiring. I have a quick suggestion about your closing intro line: while I appreciate the lighthearted spirit of "Who me, yes you," I find it a bit childish and annoying with this changing voice… Personally, I'm much more drawn to your empowering statement, "Here to help you make your Game Dev dreams become reality." It simply feels more mature and really resonates with me and feels perfectly consistent with your overall message. I wonder if it might be interesting to poll your viewers and see what they prefer?
@LlamAcademy
@LlamAcademy 4 ай бұрын
Thanks for the feedback. Do you dislike the entire "yes you" portion or do you feel I'm taking it a little over the top with the voice changing and all that around it?
@PRodi_
@PRodi_ 4 ай бұрын
@@LlamAcademy I personally find the "Who me, yes you" (only this 4 words) line a bit annoying and I'd really enjoy hearing your natural tone without the pitch shift. I think it would create a more natural and engaging connection with the audience.
@LlamAcademy
@LlamAcademy 4 ай бұрын
@@PRodi_ I appreciate that. I may have gotten a little carried away with that part and I agree it can feel like it cheapens the sincerity of the part that is meaningful.
@tianbornman6115
@tianbornman6115 3 ай бұрын
@PRodi_ What a blockhead statement to make bro, the mans made a good vid. Keep doing you @LlamAcademy man, great vid
@HouseTrapJay
@HouseTrapJay 4 ай бұрын
I built a physics-based knockback system on navmesh enemies very recently. Can't wait to see how you handle it to compare notes. Something tells me I'm gonna need to do some re-writes after I finish watching...
@LlamAcademy
@LlamAcademy 4 ай бұрын
😁 I'd love to hear about your implementation! I know some people will use the NavMesh and push back solely on the NavMesh. I found that more complex than this solution
@cengizgorencom4251
@cengizgorencom4251 4 ай бұрын
very cool dude..
@LlamAcademy
@LlamAcademy 4 ай бұрын
Thanks ☺
@raztaz826
@raztaz826 4 ай бұрын
This is good, but I think it's a lot of work to work around the limitations of the built in Unity navmesh agents system. I prefer to use Aaron Granberg's A* implementation and have rigidbodies active all the time so that they can be knocked or pushed by anything at any time.
@LlamAcademy
@LlamAcademy 4 ай бұрын
That is a great system that does avoid a lot of the limitations of the built in navigation system.
@user-co5ly6tw6c
@user-co5ly6tw6c 2 сағат бұрын
why not just change agent velocity to the force direction?
@brodakarat6340
@brodakarat6340 4 ай бұрын
I'm meeting an issue right now as I've just discovered unity organisations and ready to make my first whole game. I'm scared about the legal rules around purchased assets when working in a team thru unity plastic scm. It would be great to have a video describing things like seats and how to "do it right" when using outsourced assets in a publicly released game
@oddlaceguy9697
@oddlaceguy9697 4 ай бұрын
Could you please make a video on the method of extracting the path and then setting the rigidbodies velocity toward the next path node?
@LlamAcademy
@LlamAcademy 4 ай бұрын
You can probably take the path calculation from here (really just NavMesh.CalculatePath) kzbin.info/www/bejne/qZTEc3t-e7B_gpI Then apply force to the rigid body in the direction of the next corner
@MrShadow274
@MrShadow274 4 ай бұрын
Nice tutorial and very useful to make you game feel less static! I have a question: how can you get nav agent back on NavMesh if its gets knocked out of it? I have AI npc's that use character controller to move, but sometimes if they run too fast or get knocked they get off nav mesh and get stuck. If i just do Warp to closest nav mesh point it wont fix the problem since i need to move the whole character back to navmesh again. Maybe you have some good solution for this? Thanks!
@LlamAcademy
@LlamAcademy 4 ай бұрын
Warping is the only built in method of getting the agent “back on the navmesh”. Remember the navmesh is the representation of walkable (or otherwise traversable) areas of the AI. If they’re off this then something really bad happened. Perhaps in the closing segment of this video those ideas could help. Depending on how “off” they are and how your scene is configured, you may be able to just lerp or move them back following a curve, then warp them to that position.
@bonse2000
@bonse2000 4 ай бұрын
can you make a tutorial about the outlines in our game?
@LlamAcademy
@LlamAcademy 4 ай бұрын
I'm actually using www.youtube.com/@danielilett 's method for outlines I learned about it here: kzbin.info/www/bejne/jHioq2ulgN6Aprssi=IlmsCu8-hiJR8kMh
@flying.volcano.studio7727
@flying.volcano.studio7727 4 ай бұрын
Good day Liam, i hope u are doing well. how to make cinematic introduction scenes like short movie clip for game. whats the best way?
@LlamAcademy
@LlamAcademy 4 ай бұрын
I think the "Timeline" package is what you're looking for
@LowLevelLemmy
@LowLevelLemmy 4 ай бұрын
workout tutorial pls
@LlamAcademy
@LlamAcademy 4 ай бұрын
step 1: lift heavy thing step 2: get big 💪 😜
Which AI Behavior Framework Should You Use? | AI Series 46
17:26
LlamAcademy
Рет қаралды 35 М.
Когда на улице Маябрь 😈 #марьяна #шортс
00:17
NO NO NO YES! (50 MLN SUBSCRIBERS CHALLENGE!) #shorts
00:26
PANDA BOI
Рет қаралды 102 МЛН
🍟Best French Fries Homemade #cooking #shorts
00:42
BANKII
Рет қаралды 31 МЛН
GOAP Enemy AI FULL IMPLEMENTATION | AI Series 50 | Unity Tutorial
1:10:13
Unity Performance Tips: Draw Calls
4:24
Lofi Dev
Рет қаралды 176 М.
4 Ways to MOVE (Pros and Cons) in Unity
8:01
Sasquatch B Studios
Рет қаралды 6 М.
SIMPLE Tip For Better Unity Game Architecture
12:57
git-amend
Рет қаралды 24 М.
4 Unity Destruction Libraries Compared - Which is best for you?
18:45
ADVANCED AI IN UNITY (Made EASY) - STATE MACHINE BEHAVIORS
8:15
Blackthornprod
Рет қаралды 234 М.
How much MONEY my Game made (and how much it cost!)
14:00
Code Monkey
Рет қаралды 152 М.
I Made a Game Using ChatGPT
9:51
Rye
Рет қаралды 2,5 МЛН
Когда на улице Маябрь 😈 #марьяна #шортс
00:17