Thank you very much for the feedback. Afair most of the player scripts become disabled after you won. So I hope that you could've seen the full sequence. But because I was really in a hurry I also would expect some bugs.
When I started the game I actually wanted to put a restriction on ammo but I completely underestimated the FPS-Controller ^^. I think I nearly spend half of my time to get the controller at least somehow there where I wanted it. To share a little bit my journey:
- At first I thought it would be easy. Just place the weapon. Then I saw: weapons can clip through objects. Not good.
- Adding a second camera which is only rendering the weapon. I thought: "you can put the weapon anywhere - bullets will spawn in front of the player". So I putted it under the world until I noticed: it doesn't receive any shadows. So lets put it back to the player
- Spawning bullets in front of the player and just shoot forward sounds like a really good idea. Cause aiming feels like what the player expects. But it never fits to the angle of the weapon. But for some reason I wanted to have bullets and wanted to stick with it
- Using Raycast to detect targets in front of you and spawn bullets from the weapon. Using the information from raycast to tell the bullets to fly there. I think that is actually the trick
In between there were ofc somer other obstacles. Well - the good thing is: I learned a lot. But in that time I really wondered how other games did it. And if they really use bullets or only raycasts. When I played Overwatch in the evening and saw that there it is really looking like I want to have it - I felt very jealous ^^. I actually started shooting walls just because I wanted to discover a hint how they did it. Even after I've implemented the raycast-thing I still wasn't sure.
Regarding your mesh collider: I also thought about it - but decided against it. Cause the shape is very easy. And in my case the mesh collider wouldn't have helped. The problem is that bullets disappear on collision. But you are right with the damage-on-ray-hit. (The player might wouldn't notice if the bullet disappears a little to early).