Dual camera shadow problem
I'm currently making a fps, i had a problem that my weapon was cliping through walls, so i made another camera and i set it to render only the weapon on a different layer. It works, the weapon doesn't clip through walls, but now i have a problem that shadows don't interact with the weapon, because the objects are on different layers. Could someone help me fix this?
To get a better understanding of what i mean, see this. This persons solution is to duplicate every shadow casting object to the layer witch the gun is, and set the mesh filter to shadow cast only. I don't use his solution, because i find it too messy.
Answer by NateJC · Jul 29, 2016 at 04:45 PM
I figured out a workable solution for my case:
1) Make a parent game object that has the collider & rigid body
2) Now add two nested children to it, each with the same Mesh + Mesh Renderer components
3) Name one of them "View" and the other "Shadow Only"
4) For the View object, use these settings:
5) For the Shadow Only object, use these settings:
6) Now apply all physics & animations to the parent object, and everything else should work naturally!
Answer by Reasqn · Oct 23, 2016 at 06:32 PM
yes that is nice, but what if we have 30 weapons with differents hands, each weapon has his own scope etc... I have more than 100 objects...