- Home /
Camera collision seeing through walls problem
Hello,
I saw this is a common question, but I didn't found any working solution on my case.
I'm trying to stop camera seeing through walls on a third-person game.
I'm using the C# version of this script: http://unifycommunity.com/wiki/index.php?title=SmoothFollowWithCameraBumper
This script works great, the only problem it's when the target is closer to wall, the camera can see through this wall.
I tried several solutions, like changing to lower near clipping plane, but doesn't works very well in some cases.
I'm sure the problem is when rotating the Y-axis camera on Quaternion.LookRotation, but I can't figure out how to modify this script to accomplish this issue.
Any idea?
Thanks!
I recommend using raytracing to make sure there are not obstacles between the camera and its target. If there is something between them, it should move the camera forwards until the view is clear.
I'm using Physics.Raycast, and when a collision is performed the camera doesn't moves behind the wall, but sometimes can see through this wall, that's basically my problem.
It happens for example on a corner (formed with 2 planes, so they are thin meshes) when my player is close to this corner and I'm rotating the player 360º.
The camera is looking to my player with Quaternion.LookRotation and it moves on hit.position
Your answer
Follow this Question
Related Questions
How to get A Camera Collision? 1 Answer
Why are my bullets acting as being deflected by the camera borders collider? 0 Answers
3rd Person camera collision 2 Answers
Camera Rotation 2 Answers
Very complicated collider problems 0 Answers