How to make the first person model doesn't cross walls?

Hi everyone,

I show you with images what I need because I’m very bad expressing myself in English.

So, for example:

When you approach to a wall:

I want to see all the weapon model, but I don’t know how.

For example, in Counter-Strike 1.6, this doesn’t happen:

If you need some part of code or something, just tell me, because I don’t know what part I need to edit.

I hope what I have requested is possible.

One possibility could be here: Custom Depth in Unreal Engine - Tom Looman

Custom depth is a value attached to a material to go in front of other stuff… just like what you’re trying to achieve.

Good luck!

Why not just have collision proxys setup for the gun, then it will collide and not go through.

Here is the Unity3D answer.
http://answers.unity3d.com/questions/39420/gun-goes-through-wall-in-a-fps.html
Unity puts the weapon on a separate layer and uses depth on the camera(sometimes, they use multiple cameras), so that it doesn’t go through walls.

Hopes this helps.