EDIT: I used to see through walls.

EDIT: The original post below is all well and good, but I learned what my problem was yesterday, and I thought I’d share my facepalm with you. Setting the clipping planes near nor far did anything, no setting change did anything to fix my problem. Couldn’t figure it out for the life of me. So, why was I seeing through literally every single model and GameObject?

Because the player’s camera was in front of the player! So it was reaching the model before the player reached the collider. D’oh!

One small issue comes up now, however. Placing the camera above my player is messing with forward movement. For some reason, I simply can’t walk forward sometimes. Haven’t spent too much time with it yet, but if anyone knows a solution to THAT, cool. Otherwise I’m gonna keep messing with it. God bless.

Further edit: moving the camera up or down seems to affect whether the player can move in a certain direction. I’ve been able to stop forward, left, right, or backward movement based on cam position.

END OF EDITS


Hello again. Solved an issue that I had asked about a couple of months ago, where the question was closed (wrongly) because the person who closed it assumed it was a duplicate question. That thread can be found here.

The gist of it was, no matter what I did my character could see through walls, cubes, 3d models, etc. as long as I stood close enough to them. The problem had nothing to do with the camera, culling masks, etc. as none of the traditional fixes did a lick of good to fix the issue. So I posted, got a snarky answer and a “topic closed” message back, and no assistance. Well, here we are, and the answer was so much easier than I though. What was it?..

The problem you’re having is something even AAA titles have problems with. It is often called occlusion culling, and happens because the near clip plane of the camera is behind a renderer.

There are many tricks but I really don’t think your solution is good in the long term. For example when you start putting particles/decals/quads(bulletholes) around your scene and are using raycast, you will have to start factoring in the offset of the collider to the rendered surface. And everytime you introduce something to a scene, you have to rescale the collider.

As the issue is with the camera, work with that. I have read things like putting a collider on the camera; or have raycasts that detect when something is very close to the near-clip plane of the camera and tells it to compensate by moving, or tells the controller to not move in that direction. The technique also depends on the type of camera, I assume you mean 1st person, but there is also 3rd person, top down, etc.

In summary, I think you are going down the wrong path that leads to lots of unnecessary work. Work on stopping the camera from seeing through things. Who knows, maybe you just need to decrease the near clipping plane in the inspector.

.
alt text

Simply increase the size of the box collider around the wall / cube by a tiny little bit. I posted this topic in the event that someone else has the same issue. God bless.