To keep the last rotation when the stick is released, you would just want to put in a check that uses the last rotation when it detects the stick is reset back to it’s default position. I can provide a work around if you hit a wall trying to implement that functionality.
Also, you can use the mesh’s rotation to calculate the vector in which you wish to fire your gun.