Procedural Recoil and Bullet Spread | Gun Series 2
Published: 01 Nov 2022
Learn how to implement procedural bullet spread and gun recoil ๐ฅ into your game with this ScriptableObject-based gun system (Part 2 of the Gun Series!)
In this Unity Tutorial you'll learn how to implement recoil/bullet spread in 3 ways -
1. No spread - always perfectly accurate
2. "Simple" Spread - the most common way you'll find to implement spread, based on random values in a Vector3 Range
3. Texture-Based Spread - sampling a texture to define a "pattern of randomness" based on some texture data. Using this you can get something like the recoil in popular games such as Counter-Strike.
Bullet spread and Recoil are inseparable topics, because the recoil actually makes the bullet spread happen! Learn how to do both in this tutorial!
๐จโ๐ป As always, all code from this video is available on GitHub: https://github.com/llamacademy/scriptable-object-based-guns
๐ท๏ธSave 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: https://www.jetbrains.com/store/?section=personal&billing=yearly
๐ Resources:
โซ Texture2D: https://docs.unity3d.com/ScriptReference/Texture2D.html
โซ Texture2D.GetPixels: https://docs.unity3d.com/ScriptReference/Texture2D.GetPixels.html
โซ Texture2D.GetRawTextureData: https://docs.unity3d.com/ScriptReference/Texture2D.GetRawTextureData.html
โซ More in-depth explanations on the sampling of texture data here: https://youtu.be/yqlFrLGeRaQ
In this series you'll learn how to make a configuration-driven gun system with ScriptableObjects that will be able to have:
โซ Hitscan Guns - Covered in Part 1: https://youtu.be/E-vIMamyORg
โซ Projectile Guns
โซ Simple Bullet Spread - Refined in this video
โซ Complex Bullet Spread - Covered in this Video
โซ Reloading
โซ Attachments
โซ Animated Models
โซ Simple Impact Damage
โซ Damage Effects such as burning, freezing, explosions, etc...
โซ And even more!
๐งก Believe in LlamAcademy's mission and have received value from the videos? Here's how you can show your support:
๐ Patreon: https://www.patreon.com/llamacademy
๐ YouTube Member: https://www.youtube.com/channel/UCnWm6pMD38R1E2vCAByGb6w/join or click the Join button on any video
๐ Take my Unity ShaderGraph Course:
https://www.gamedev.tv/p/unity-shader-graph?affcode=45216_kuvg0bp7
๐ Get yourself some LlamAcademy merch: https://llamacademy.myspreadshop.com/
๐ธ Use my Affiliate Link for Humble Bundles https://humblebundleinc.sjv.io/9g4ak4
๐ธ Publisher Sale! 50% OFF an entire publisher's Assets! Publisher changes weekly! https://assetstore.unity.com/publisher-sale?aid=1101l9QvC (affiliate)
๐ธ Save up to 50% on NEW Assets: https://assetstore.unity.com/?new_sale=true&orderBy=1&aid=1101l9QvC (affiliate)
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.