3D Help! My weapon goes through walls..

I am working on a 3D FPS game, but whenever I look down or get close enough to a wall, the weapon goes into the wall/floor. What can I do to prevent this?2.png 3.png
 
Thanks f
Either turn off depth test when rendering the gun, or render the gun to a separate surface and overlay it.

The prior will be more efficient.

d3d_set_zwriteenable(false);
fo the reply, but whenever I use it, it makes my walls invisible and the objects outside visible through the walls
 
Top