1st person Camera to 3rd person

Heya,
I using Unity 1st person Camera but trying to make it 3rd person.
I have moved the Camera back so you can see the “Object” But the problem i’m having is the Camera still thinks it’s “1st person” I’ve removed the “Mouse Look -360 / 360” but that doesn’t do nothing is there something i’m missing that needs to be removed/update? Is their a more simple way to fix this little problem?

Thank you
Luke

I did this before. All first person camera controls were in 1 function and the 3rd person camera controls were another function. Have some variable to tell which should be called and use an if statement in your update function to decide which function to call.

If it looks like pieces of both are running, then there’s either an error in your third person script that is doing what the first person script does or somewhere you’re calling both.

–edit

I should mention I used my own scripts for camera movement since I didn’t want to worry about running into a problem JUST like this by modifying the sample.

1 Like

Yer, I think i might do the same tbf. Thank you 4 your help tho.

If you skim through the camera code, you’ll notice you don’t need all of what’s there. Here’s what I pulled out to get a functional camera :smile: If you want to walk around, make movement based on a body. If you want to fly or swim, make movement based on the camera position. Good luck!

Camera head;

    //camera related
    float rotation_x = 0;
    float rotation_y = 0;
    float h_speed = 2;
    float v_speed = 2;
   
    float minX = -360;
    float minY = -90;
    float maxX = 360;
    float maxY = 90;

    public void init()
    {
        head = Camera.main;
    }//init

    public void playerUpdate()
    {
        camControls();
    }//playerUpdate

    void camControls()
    {
        //get input
        rotation_x += Input.GetAxis("Mouse X") * h_speed;
        rotation_y += Input.GetAxis("Mouse Y") * v_speed;
       
        //fix input
        if(rotation_x > 360 || rotation_x < -360)
        {
            rotation_x = 0;
        }
       
        if(rotation_y > 360 || rotation_y < -360)
        {
            rotation_y = 0;
        }
       
        rotation_x = Mathf.Clamp(rotation_x, minX, maxX);
        rotation_y = Mathf.Clamp(rotation_y, minY, maxY);
       
        //apply rotation
        head.transform.localRotation = Quaternion.AngleAxis(rotation_x, Vector3.up);
        head.transform.localRotation *= Quaternion.AngleAxis(rotation_y, Vector3.left);
    }//camControls