Weapon clipping through walls. Solutions?

I noticed if I walk too close to a wall, my weapon clips right through. I was wondering what the best way to overcome this issue is.

I tried putting both a collider and a RigidBody (no Gravity) on the gun itself, but that doesn’t do anything and I don’t understand why. Though another collider didn’t work on my player capsule and I was tolk there was a collider from the Character Controller component, so maybe that’s a related issue since the weapon is a child of the main camera, which is a child of the PlayerCapsule.

The other solution I considered was to move the main camera back so the gun would be within the range of the player collider, but that would presumably also make it so I couldn’t get very close to walls. Should I just try to extend the player collider outwards?

Hi,

There are lots of free Unity tutorials on Youtube. I found this one:

Did this help you fix the problem? :slight_smile:

I’ve done this one before. @Nina’s link should help. You basically have 2 cameras - one renders everything except the weapon, and the other one renders only the weapon. The weapon cam is then overlaid on top of the other

Thanks for the advice! This was a nice quick fix. Sorry for the late reply - been preoccupied with BG3.

I am curious, though - what is it about the PlayerCapsule or Character Controller that seems to stop all other rigid bodies/colliders from functioning?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms