1
\$\begingroup\$

This is a FAQ, and answers involve camera stacking. I am not using a SRP. I do not want camera stacking as various post-processing instructions (e.g. FXAA, MSAA, etc) are all done on the active camera, and redoing all these instructions on multiple camera would be costly

Is there any way to prevent weapon clipping through walls without using camera stacking or a SRP?

\$\endgroup\$
6
  • \$\begingroup\$ without SRP? You just make another camera with far clip of 1 and near clip 0.001, give it depth 1 more than main camera depth, set it to render only weapon object's layer. Remove unnecesary stuff like audio listener from it, this should be it. Its performance cost will be small. If you really don't want to use multiple cameras, then you need to somehow render only weapon to rendertexture from main camera and then probably use it as UI element, and last way is just modifying weapon's material render queue to overlay. \$\endgroup\$
    – Nick
    Mar 17, 2020 at 8:07
  • \$\begingroup\$ You wouldn't usually redo your post processing instructions on multiple cameras. The whole benefit of "post" processes is that you don't have to — they come at the end, "post" ALL camera rendering. So you still do them only once, after all of your cameras have finished their work for the frame. \$\endgroup\$
    – DMGregory
    Mar 17, 2020 at 12:30
  • \$\begingroup\$ @DMGregory Not exactly; the objects in my stacked cameras are not affected by antialiasing, while those in the primary camera are. Maybe an alternate solution would be figuring out how I can apply these effects on all cameras. \$\endgroup\$
    – blackhole
    Mar 18, 2020 at 3:22
  • 1
    \$\begingroup\$ Sounds like you configured your post processing stack on the wrong camera. \$\endgroup\$
    – DMGregory
    Mar 18, 2020 at 11:22
  • \$\begingroup\$ @DMGregory Yep; that's it. Thank you! \$\endgroup\$
    – blackhole
    Mar 19, 2020 at 0:35

1 Answer 1

0
\$\begingroup\$

I fixed this issue in a simple way: by taking a step back when my weapon bumps on something.

It works absolutely fine for me. Please take a look at it.

I hope it helps someone.

\$\endgroup\$
2
  • \$\begingroup\$ If you can't comment, you shouldn't use answers instead. However, since you have an actual solution to propose, you may expand your current answer and include more details about how to fix OP's issue rather than just attaching an external link, which is possibly prone to not working for future readers. \$\endgroup\$
    – liggiorgio
    Jul 6 at 10:02
  • \$\begingroup\$ Oh well.. i did mention "By taking a step back when my weapon collides with something". I can't show full implementation (And how well it works for me), hence a youtube video where i showed step by step. Looks like i am able to comment this one.. \$\endgroup\$ Jul 7 at 12:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .