- Home /
Colliders don't work
Guys I am making a game in unity 5 in which there is a cylinder object and you have to roll it to a point to win. I have a maze - like map and I used the built-in 1st person character controller. The problem is that my player can see through walls when I go near them. Tried to make the collider bigger on the 1st person character controller, but I didn't find any. I added it manually (capsule collider of course) but still - no effect. I made it very big to see if it works - it doesn't while the other objects work properly. The "Is trigger" checkbox is unchecked. My sphere doesn't collide with anything except the floor of the map (it doesn't go through the walls but still I can see through them). If you want any extra info ask in comments! If you want I can make a video and upload it to youtube so you can see what is the problem.
If you can't walk through any of the walls then the camera might just be too far forward from the rest of the player.
+ShikenNuggets oh thanks, it worked but still my player can see through the walls when it turns its head. I mean if I go and face directly to the wall it won't see, but when I turn my head near a wall I still can see. Also I don't know how my player collides with other gameobjects without having a collider. And if I add colliders they have no effect.
Answer by StrykerS. · Apr 27, 2015 at 03:32 AM
Select your camera and go to the near clipping planes setting and reduce it to something like 0.001. What happened is the camera by default doesn't start rendering anything for 0.3 meters (by default) away from the origin point. This means that if your viewing frustum is pointing through a wall anything closer then 0.3 meters to the cameras position will not be rendered resulting in the problem you are experiencing. Hope this helped. Ps if your camera is still inside the capsule mesh that's attached to the fps controller by default reducing the near clipping point too much might cause it to show up as a strange looking graphical error. To avoid this either raise the camera so it's no longer inside the mesh or place the mesh on a layer and tell the camera not to render it.
Thank you Sooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo much, without you I would never find this. Thanks one more time lol :D
Your answer
Follow this Question
Related Questions
Best collision detection method? 2 Answers
Projectiles, their speed, and collisions 1 Answer
overlapsphere to destroy NPCs on exit 1 Answer
Collider2D that not collides 1 Answer
How to stop my sword from hitting myself 2 Answers