Hi
I made a simple script that allows the user to move the camera with mouse movement.
It works like a charm, but now I would like to add a starting position(directly behind the car).
Since the car is moving I would need to calculate the mouseX and mouseY positions from the car current position. I have no idea, how I could archive that.
Also, how could I move the camera, when the car is rotating?
Camera mouse movement script:
mouseX -= Input.GetAxis("Mouse Y") * sensitivity;
mouseY += Input.GetAxis("Mouse X") * sensitivity;
mouseX = Mathf.Clamp(mouseX, minMaxXAngle[0], minMaxXAngle[1]);
Vector3 targetR = new Vector3(mouseX, mouseY);
transform.eulerAngles = targetR;
transform.position = target.position - transform.forward * distanceDamp;
//Debug.Log(target.transform.rotation.x + " " + target.transform.rotation.x);
Vector3 temp = transform.position;
temp.y += 1;