I found a free bullet asset on TurboSquid by signSTUDIOS. I imported this by dragging and dropping it into the project view.
By creating a Blueprint file called Projectile_Template, I added a Static Mesh and set the imported asset as the Static Mesh in the details panel.
I modified the transform scale and rotated it in order to get a realistic size, and firing out the right way of the gun.
In a Blueprint file named Weapon_Template, I have added a custom event for Fire. This is to set-up a place for the bullet to shoot out of. Using the skeletal mesh (bullet) as a reference, and getting the socket transform "Muzzle" which is a socket on the gun where the bullet is positioned to come out of I have set this as the Spawn Transform.
With this custom event Fire, we will be able to use this in the First Person Character blueprint to enable firing a bullet from the gun muzzle.
In the Project Preferences under Input the Left Mouse Click is assigned to the Fire button by default, which is what I want to keep it as.
Using the nodes, I have implemented a variable that detects whether the player is equipping a weapon. If the player is, and the Fire button is activated (Left Click) then we are able to shoot.




No comments:
Post a Comment