Going through walls when moving IRL

I’m using the unity VR template with the character controller and XR default inputs for movement. I have a capsule collider on the VR rig. When I walk using the joystick into the wall, the collisions work fine but if I move in real life, I can just go in the wall. I tried using scripts to push the player back if they try to look in the wall but the corrections are harsh and disruptive even when i try to make it more smooth. Also if i move the headset really fast it still goes in the wall. Is there any fixes for this?

This is a common issue in all VR apps I’ve played and I would not recommend trying to prevent it, because it will always feel weird and disruptive, possibly even nauseating. Some games I’ve played have instead blinded the player in some way when they move their head into an object, either with some kind of graphical effect or by darkening the view (sometimes with a message saying they should go back). In a project I worked on that featured interiors with windows through which a skybox could be seen, I modeled an outer shell of secondary walls around the actual walls with a dark material that would be seen if the player sticks their head through the walls. That was a very limited solution, however, and it required manual work for each interior scene (but it was a small project, so it was manageable in this case).