Home

Awesome

Knockback NavMesh Agents (AI Series 51)

In this tutorial repository and accompanying video you will learn how to knock back NavMeshAgents using Physics & Forces!

Youtube Tutorial

Quickstart

This repo uses the Scriptable Object Gun System as of branch part-14 to handle shooting. This was then modified to add knockback. There's nothing specific to this system required to make the knockback effect work. It just was a launching point to allow this to focus on the knockback instead of implementing a bunch of systems from scratch.

  1. Import Unity Particle Pack (free)
  2. Click play!

Everything should be working from there.

Key Classes

While I highly recommend you check out the video for a complete understanding, I also understand that's not everybody's cup-of-tea. Here are the key classes if you just want to explore:

  1. IKnockbackable.cs - Interface to allow arbitrary objects to be knocked back
  2. EnemyMovement.cs - Implements IKnockbackable to handle how to get knocked back.
  3. KnockbackOnCollision.cs - Applies force to IKnockbackables OnCollisionEnter
  4. GunScriptableObject.cs - Applies force to IKnockbackables when bullets make impact
  5. KnockbackConfigScriptableObject.cs - Houses the configuration for the knockback effect as well as calculating the

Sponsors

This tutorial is Sponsored by Southern New Hampshire University. If you're interested in leveling up your gamedev skillset, consider getting an affordable, accredited degree in Computer Science or Game Design & Development from SNHU. You can go to https://snhu.edu/llamacademy to see what the current average annual salary for a game developer programmer is and learn how you can get started!

Supporters

Have you been getting value out of these tutorials? Do you believe in LlamAcademy's mission of helping everyone make their game dev dream become a reality? Consider becoming a Patreon supporter and get your name added to this list, as well as other cool perks. Head over to the LlamAcademy Patreon Page, join as a YouTube Member, or even become a GitHub Sponsor to show your support.

Phenomenal Supporter Tier

Tremendous Supporter Tier

Awesome Supporter Tier

Supporters

Other Projects

Interested in other Topics in Unity?

Requirements

Disclaimers

Some links in this readme may contain affiliate links which, at the time of purchase, at no additional cost to you, gives me a small portion of the purchase.