Top Down Camera View Problem

Hello, i work on a 3d top down game, and recently i try to improve my camera system by adding and extended view like Running With Rifles’s one ( something like this: Line of Sight, Vision - Official Running With Rifles Wiki). And i achieved something but not very good, it doesn’t work how it should do. So, if somebody can help me with an advice or an example, i will appreciate very much.This is the code:`

public class CameraManager : MonoBehaviour
{
	public Transform target;
	public GameObject player;
	public float distance = 2.0f;
	public float centerOffset = 1.0f;
	public float height = 15.0f;
	public float damping = 3.0f;
	private float inputX;
	private float inputY;
	private float wantedHeight;
		
	void Update() {
		if(target) {
			wantedHeight = player.transform.position.y + height;
			
			inputX = (Input.mousePosition.x - Screen.width * 0.5f) / Screen.width;
			inputY = (Input.mousePosition.y - Screen.height * 0.5f) / Screen.height;
			
			Vector3 targetPos = new Vector3(target.position.x + inputX, wantedHeight, target.position.z + inputY - distance) + player.transform.forward * centerOffset;
			transform.position = Vector3.Lerp(transform.position, targetPos, Time.deltaTime * damping);
			transform.eulerAngles = new Vector3(90 - inputY, 0, 0);
		}
	}
}`

Thank you.

Okay I have seen your code, Me also researching about the camera control system of the game, “Running With Rifles”. I searched a lot but didn’t find any good references of that type of moment system. After that I saw your Question and I just used it and after some modification, I finally found something 98% closer to that game, ummm its not perfect, but its closer enough. Hope that will be helpful to you, here is my modification on your code:

using UnityEngine;
using System.Collections;

public class CameraManager : MonoBehaviour {

	public Transform target;
	public GameObject player;
	public float distance = 1f;
	public float centerOffset = 0.1f;
	public float height = 18f;
	public float damping = 10f;
	private float inputX;
	private float inputY;
	private float wantedHeight;

	void Update() {
		if(target) {
			wantedHeight = player.transform.position.y + height;

			inputX = (Input.mousePosition.x - Screen.width * 0.5f) / (Screen.width/8);
			inputY = (Input.mousePosition.y - Screen.height * 0.0001f) / (Screen.height/8);

			Vector3 targetPos;
			if (Input.mousePosition.y > 5) {
				targetPos = new Vector3 (target.position.x + inputX, wantedHeight, target.position.z + inputY - distance) + player.transform.forward * centerOffset;
			} else {
				targetPos = new Vector3 (target.position.x + inputX, wantedHeight, target.position.z + inputY - distance) + player.transform.forward * centerOffset;
			}
			transform.position = Vector3.Lerp(transform.position, targetPos, Time.deltaTime * damping);
			//transform.eulerAngles = new Vector3(90 - (inputY*2f), 0, 0);
			
		}
	}
}