Jump to content

 i am coding a third person character and this code will not work either it says on line 31 there is a

{



}

expected but i already have one here is the code



using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameCamera : MonoBehaviour
{

    [SerializeField] private GameObject target;
    [SerializeField] private GameObject rotationAnchorObject;
    [SerializeField] private Vector3 TranslationOffset;
    [SerializeField] private Vector3 followOffset;
    [SerializeField] private float maxViewingAngle;
    [SerializeField] private float minViewingAngle;

    private float verticalRotationAngle;

    private void FixedUpdate()
    {
        //make the camera look at target
        float yAngle = target.transform.eulerAngles.y;
        Quaternion rotation = Quaternion.Euler(0, yAngle, 0);

        transform.position = target.transform.position - (rotation * followOffset);
        transform.LookAt(target.transform.position + TranslationOffset);

        //make the character look up or down
        verticalRotationAngle += Input.GetAxis("Mouse Y");
        if (verticalRotationAngle > maxViewingAngle) ;
        {
            verticalRotationAngle = maxViewingAngle;
        }
        else if (verticalRotationAngle < minViewingAngle)
        {
            verticalRotationAngle = minViewingAngle;
        }
        transform.RotateAround(rotationAnchorObject.transform.position, rotationAnchorObject.transform.right, - verticalRotationAngle);
    }
}

 

Edited by wkdpaul
code tags
Link to comment
https://linustechtips.com/topic/1260436-unity-compile-errors/
Share on other sites

Link to post
Share on other sites

3 minutes ago, Jackb said:

if (verticalRotationAngle > maxViewingAngle) ;

The ; at the end of this line is giving the error.

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
https://linustechtips.com/topic/1260436-unity-compile-errors/#findComment-14139989
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×