Unit 8: Production for Dau abare Part 4 ~ secondary weapon full set up.



22/05/2018 - 31/05/2018

secondary weapon full set up.



now adding a secondary weapon was troublesome so say the least for example every time i tried to add one in the player would ignore the weapon thinking that it ( the weapon) didn't actually exist, in this blog i'm going to explain how i added in a secondary weapon and made it function how its supposed to.

weapon M4A1


the first thing i did was actually add in the item into the game, this was simple as there are materials you can use provided by unreal engine including some gun meshes. much like the AK-47 i had to add a skeletal mesh and projectile spawn point from the add component drop down, this was done to allow the player to see the weapon and shoot from the muzzle as seen in the image above. 


weapon M4A1 event graph


the image above shows the first blue print i used on the M4A1 which basically means that when the player presses the left mouse button the gun shoots. 

M4A1 Texture and static mesh 

Texture


now adding the texture was simple i just created the texture mat and connected the texture sample to the M4A1 texture as sen in the image above. 

static mesh 


the next thing i did was create a static mesh in order for the player to be able to actually pick up the weapon, this is because on unreal engine you can't actually change the collision effects on a skeletal mesh  that affect the third person character. 

adding final features 

third person character



now that i had everything working proper again i had to add the blue prints on the third person character that would allow the user to actually switch between the guns and use the M4A1 in game, to do this i made an addition  to the HUD blue print, which simple was to allow the player to see and use the gun in game as seen in the image above.


 right after that i added another blue print that would use my input buttons features seen before. that means when the player clicks on 1 or 2 the gun would switch.



Hud 



Finally in order the make these new features aesthetically pleasing i went back on my blue print and added 2 images which would become icons of the M4A1 and the AK-47 and added blue prints on each of them to communicate with the third person blueprint where if the player switches guns then show the appropriate icons and ammo as seen in the image above.



This is how it looks in the game:




Comments