Making the player weapon collide with world?

OK, how was this done?

Not sure if this is only works for the player view model or if it also works for the 3rd person mesh.

Hey, just a thought, I have seen something like this implemented in another engine with IK and a trace.

I was thinking it was done with the IK System. But I could see how it could quickly get complicated trying to merge it with weapon animations.