Unity Attach Weapon to Character
In the following tutorial i will guide you through the process of attaching a weapon to a character using unity engine with a little bit of c# coding.
Ready to start , lets go , fire up unity and make sure you have a basic character with the desired weapon to attach make sure both of them are visible in the scene
In this tutorial we assume that your character is already rigged and has a valid bone structure , we need that to specify where the weapon is going to be attached , for more information regarding character bones and rigging .
Regardless if your not using a humanoid character you can just attach the weapon to any sub-mesh or even the original mesh itself,
Once you get everything setup you need to create a small script to attach the weapon to the character , the script will have 3 states ,
- Idle Position
- Handheld Position
- Shooting Position
You can add as many states as you wish but for this tutorial we are going to cover the three above , so lets get started