FPS Weapon Collision Problem

Hello Guys,

I’m having a problem with the collision of our “weapon” in our game…

The only sollution i’ve found is to resize the Capsule collider, but the problem is that the character seems to be colliding way before really hitting the wall (because the collider is way bigger).

Is there a way to put the weapon in a specific layer that if even if the hand collides it doesn’t render the colliding, because the hand must be fully rendered at all times? Or any other way to solve this?

Pictures:


Actually that’s how all major games do that - they just render weapon on top of everything.

You will have to write a shader (or find one somewhere) which doesn’t do Z-check. You’re looking for ZCull=Off, IIRC.

I’ve seen it done using camera culling or depth or something. Unity has a tutorial on this. Sadly I can’t help because I am not sure where I’ve seen it.

Thanks Paulius!

Do you know, where we can find some more info about writing a Shader, specificaly for the Z-check?

Our programmer doens’t have much experience with shaders, but he’s really good.

We are usign Self-Illumin Diffuse (default from unity) for the hand and a normal Diffuse for the arm, do you think we can duplicate those default shaders and make some modifications on them so the renderer will be diferent?

Thanks a lot!

No need to over complicate things, easier solution below.

Read this, it will solve your problem:

Thanks to all you guys!

Already solved the problem using the 2 camera configuration! Love you guys :smile:

If we ever meet, buy me a beer and we’re even :smile:

j/k