How to stop weapon clipping?

Now it seems like why am I even asking this as there are thousands of tutorials about it. The tutorial usually goes like this

Create a secondary camera and make it only render the weapon

The problem with this is that other player’s guns are visible through walls. I can see the weapons through walls and objects so I’m really confused about what to do about it? How do games like CS counter this issue?

You only render the local player’s camera with a second camera, not every weapon.

1 Like

I didn’t understand? Imagine I dropped my weapon behind a wall and then looked at the front of the wall that is covering the weapon. I will still see weapon because the secondary camera always only renders the second weapon. Am I doing some stupid? Please let me know

The secondary camera should only draw items that are on the ‘carried by player’ layer. When the player uses a weapon it will be placed on the carried layer. Then when the player drops the weapon it will be placed back on the Default layer where it will be drawn by the primary camera.

1 Like

So I do that by programming?

Adding the ‘carried’ layer and the second camera that renders that layer can be done in the editor but changing the weapon’s layer will need to be done through scripting.