How Do I Change Weapon Mesh
I'm attempting to create a simple press 1 - 4 to change weapon system. I'm working from the C++ first person template. I have created a method that is called whenever the player presses 1. I don't know how to proceed to write the method.
I want the ammunition in the current magazine to be kept the same whenever the player switches to different weapons.
I have read that destroying the current mesh and then making a new one with a different weapon is possible, also hiding different weapon meshes and only showing one at a time. How would I go about doing this?
This is the template code in the character class that has to do with the weapon:
// Create a gun mesh component
And then in the begin play method:
To answer the question directly, You could make something like this:
But if it were me, I'd make a new weapon class and spawn in / destroy the weapons on button press. That way you can have each one handle a fire event in its own way (Sound, particles, bullet type). The ammunition amounts can be stored on your pawn.
answered Apr 10 '19 at 04:01 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here