So basically I used the tutorial on Unity3D: Third-Person Cameras to make my 3rd person camera and it works great but I want the camera to be inverted when I move the mouse up the camera looks down and vice versa. Anyone able to help?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraScript : MonoBehaviour {
//It's the ship
public GameObject Ship;
public float TurnSpeed;
//How far away the camera should be from the ship
private Vector3 offset;
void Start()
{
//May act funny when not maximaized in editor
//Hides mouse
Cursor.visible = false;
offset = Ship.transform.position - transform.position;
}
private void LateUpdate()
{
float horizontal = Input.GetAxis("Mouse X") * TurnSpeed;
Ship.transform.Rotate(0, horizontal, 0);
float desiredAngle = Ship.transform.eulerAngles.y;
Quaternion rotation = Quaternion.Euler(0, desiredAngle, 0);
//Take the distance between the camera and the ship
transform.position = Ship.transform.position - (rotation * offset);
//Lookat the Ship
transform.LookAt(Ship.transform);
}
}