Third Person Camera Help Please

So, I’m new to game design and scripting. I recently started working on a game and wanted a third person camera. I then found a few scripts and applied them to my camera. The only problem is I cant look up or down I’m just fixed to rotating in y-axis and can only change the horizontal view. The scripting language is in C# and I’m using a mouse aim camera with a dungeon camera. Can someone help me figure out how to look up and down without changing languages.
This is the Mouse Aim script:

public class MouseAimController : MonoBehaviour {
public GameObject target;
public float rotateSpeed = 5;
Vector3 offset;

void Start() {
offset = target.transform.position - transform.position;
}

void LateUpdate() {
float horizontal = Input.GetAxis("Mouse X") * rotateSpeed;
target.transform.Rotate(0, horizontal, 0);

float desiredAngle = target.transform.eulerAngles.y;
Quaternion rotation =Quaternion.Euler(0, desiredAngle, 0);
transform.position = target.transform.position - (rotation * offset);

transform.LookAt(target.transform);
}
}

This is the Dungeon Crawler script:

public class DungeonCrawlerCamera : MonoBehaviour {

    public GameObject target;
    public float damping = 1;
    Vector3 offset;

    void Start () {

        offset = transform.position - target.transform.position;
    }

    void LateUpdate () {

        Vector3 desiredPostion = target.transform.position + offset;
        transform.position = desiredPostion;
        Vector3 position = Vector3.Lerp (transform.position, desiredPostion, Time.deltaTime * damping);
        transform.position = position;

        transform.LookAt (target.transform.position);
    }
}

I think you would do this:

void LateUpdate() {
float horizontal = Input.GetAxis("Mouse X") * rotateSpeed;
float vert = Input.GetAxis("Mouse Y") * rotateSpeed;
target.transform.Rotate(vert, horizontal, 0);
public class MouseAimController : MonoBehaviour {
public GameObject target;
public float rotateSpeed = 5;
Vector3 offset;

void Start() {
offset = target.transform.position - transform.position;
}

void LateUpdate() {
float horizontal = Input.GetAxis("Mouse X") * rotateSpeed;
target.transform.Rotate(0, horizontal, 0);

float desiredAngle = target.transform.eulerAngles.y;
Quaternion rotation =Quaternion.Euler(0, desiredAngle, 0);
transform.position = target.transform.position - (rotation * offset);

transform.LookAt(target.transform);
}
}

It won’t use the y axis because nowhere have you told it to.

So then is there a way to tell it to use the y axis. Also I did try the line that fire7side recommended and it did nothing so can I tell it to use the y-axis.

I’m kinda rubbish at understanding C# but I’m sure this little bit of code might come in useful :slight_smile:

float Vertical = Input.GetAxis("Mouse Y") * rotateSpeed;

then you would add the code so it rotates on the Y to be honest though look at the cam that comes with Unity Standard Assets I learnt loads about Cams from looking at the coding It isn’t that hard to convert it to C# as the files that come are JS. Hope this helps you out anyway.

It should use the y axis right here:

Are you sure you used all the code I posted? That line was changed from the original to add the second variable, vert.

Ya I used all the script and it didn’t do anything. I had already tried what Josenifftod had put, that was my first instinct but it said I couldn’t use Vertical.