Gun Blueprint Setup

This is where you will be creating your blueprint. You can start by creating a child of the BP_HeldObjects_Guns, or you could simply duplicate one of the existing templates under this folder.
The BP_HeldObjects_Guns is responsible for Firing Logic, as well as handling Reload, and Fire Montages. The Reload is just a Montage and no Ammo Count is currently being tracked.
If you need different functionality or wish to change the projectile or remove that all together then you would start here.
I am going to simply copy the M4A1 Rifle Blueprint and Chooser over to a folder and move the ItemData asset I created earlier over to this new folder and then rename the M4A1 files to M1A1.
----------
The Chooser is for storing Item Specific Character Data, in earlier versions I had this stored on the character but after some consideration decided it would be more manageable as the project scales up to do this on an item-by-item basis, this is under the assumption that there will be more items then character body-types.
The Item Specific Character Data contains IK Retargeter Chain Bone Settings for Correcting Anatomy Induced Offsets during Live Retargeting, as well as Held Object Offsets that determine the offset an item will have in relation to the Socket it is attached to.
Despite popular belief, retargeting animations to your character will not magically fix offsets in relation to precise hand placement on two-handed items.
Live Retargeting (IK Retargeting during Run-Time) is not expensive and during heavy testing I have not noticed any discernable impact on performance. Also, it's worth noting that unless you want every character body type to have their very own Dedicated Copies of the Animation System and Animations, which will need to be Modified to correct Anatomy Induced Offsets, then Live Retargeting will be something you will end up using Anyway.
----------
When you open the Blueprint, assuming you duplicated one as I did, then you will see an Overridden function under Items/Data called GetItemCharData. This is where the chooser is setup and will not require any changes other then the Chooser it's using.
Go Into the function and find the Evaluate Chooser:
Select it.
Under the Details Panel you will replace theirs with yours.
I simply duplicated theirs and re-named it. This item will need it's own specific Character Settings for fixing hand placement, this is 100% unavoidable and the only alternative period is to make the poses yourself from scratch. This is also completely acceptable and I will add a section later for this purpose.
It's worth noting that the Chooser will lookup the PDA_ItemCharData for your character via a GameplayTag.
This Character Tag can be assigned to your character from the Class Defaults->DAO->Defaults->CharSpecific->CharTag
If you go to the Class Defaults you will see some entries there for you to fill out, the three I have marked in the image are the main ones you should be concerned about.
Muzzle Socket Name is the socket we will use as a reference for spawning the projectiles, if your weapon doesn't have on it will simply spawn it at the origin of your item
Item Data is were the Mesh is loaded from and it's also used by the Slot system to identify which Slots the item can be placed in.
Enable AO Debugging will Simply enable a Line Trace to be ran which will be used to calculate the offset caused by Anatomy Induced Offsets. This offset will be relative to the character's hand holding the item. For the UEFN the bone names are hand_l and hand_r, when you setup your character, your character's mesh will be passed to it instead, therefore you may need to change the name of that if the hands have a different name.
You will need to add a socket to your weapon in order to fire it. If this logic doesn't suit your needs, feel free to modify it. I do not mind, in fact I encourage you to modify things to your needs. This is not a Shake-N-Bake ready to Market Game, so you'll need to modify a lot of things for your own needs along the way.
You need to change the Item Data as well so that it points to the one you created for this item.
Once you have properly added the Item Data to the Blueprint you should be able to drag it into the level and see the item there.
Note: Currently you can pickup the item but your character will not hold it properly. We will cover that in the next section
Last updated