I'd recommend to trace vice versa, from the player to the 'usual' camera position and then set the dist between camera and player closer than that where the trace hit an obstacle.