If I go as close to a wall as possible and turn to a certain angle my character is able to see through it. Does anyone know a fix for this? I am using the FPS character preset and planes for the walls.
Before positining the camera do a raycast call, and if it hits something position the camera a little before this point. A schematic view of this code:
var distance : float; //distance of camera from the player
var hit : raycasthit = Physics.Raycast (transform.position, -transform.forward, hit,distance);
if (hit)
//this gets executed if the raycast hits something
Reposition camera using hit.point as a position.
else
Reposition camera using var distance as position.
Reorient camera (using lookAt or something like that)