Make (Mostly) Accurate Projectile Throwing AI at Moving Targets #Shorts




Published: 02 Sep 2022

Full Tutorial: https://youtu.be/6YsamZNNwpQ


In this Unity tutorial, learn how to make your AI throw accurate projectiles at stationary targets given only a maximum allowable throw velocity. You can also learn how to make the AI be pretty dang good at predicting where the player will be and hitting them while they are moving, still with only a maximum allowable throw velocity. No hard coded heights, just accurate throws!


I spend a lot of the video covering how the math works out so you can understand the process we follow to get to this result, as well as covering the equations we're using so you can take this implementation and enhance it to further suit your game's needs. Of course, if this is "good enough" for you, feel free to take it off the shelf. If you're looking for even more accurate predictions or throwing over/under obstacles, don't worry! I also cover what else you need to do to take those use cases into consideration!


As always, all code from this video is available on GitHub: https://github.com/llamacademy/ai-series-part-41


📚Resources📚

⚫ Projectile Motion Wikipedia (equations): https://en.wikipedia.org/wiki/Projectile_motion#Angle_%CE%B8_required_to_hit_coordinate_(x,_y)

⚫ Kinematic Equations Source: https://www.physicsclassroom.com/class/1dkin/Lesson-6/Kinematic-Equations

⚫ Projectile Trajectory Video: https://youtu.be/8mGZBYsSXcQ



📱 Let's stay connected

YouTube: https://youtube.com/c/LlamAcademy

Patreon: https://www.patreon.com/llamacademy

Facebook: https://facebook.com/LlamAcademyOfficial

Twitter: https://twitter.com/TheLlamAcademy

TikTok: https://tiktok.com/@LlamAcademy

Instagram: https://instagram.com/LlamAcademy


----


Believe in LlamAcademy's mission and have received value from the videos? Consider becoming a Patreon supporter: https://www.patreon.com/llamacademy


----

Most tutorials come from knowledge gained making https://survival.llama.software Llama Survival - a top-down zombie survival shooter for Android and iOS.

I also have some Unity Assets (affiliate link): https://assetstore.unity.com/publishers/22409?_aid=1101l9QvC


Connect on Social Media

Some links may be affiliate links, which at no additional cost to you, gives LlamAcademy a small portion of the purchase.