Search Unity

My camera movement is not working help!!

Discussion in 'Scripting' started by LiableDuke, Feb 8, 2018.

  1. LiableDuke

    LiableDuke

    Joined:
    Feb 8, 2018
    Posts:
    33
    So i wanted to make a first person game so i thought lets start with movement. i looked up a tutorial on how to do it and i have done every thing in the vid but it says that the second time i use md that it is an unexpected symbol but in the tutorial there is no problem. (
    the vid i am reverting to) if someone could pls help me i would really appreciate that. (i am talking about the md that looks like this: "md".)

    using UnityEngine;
    using System.Collections;

    public class camMouseLook : MonoBehaviour {

    Vector2 mouseLook;
    Vector2 smoothV;
    public float sensitivity = 5.0f;
    public float smoothing = 2.0f;

    GameObject character;

    void Start ()
    {
    character = this.transform.parent.gameObject;
    }

    void Update ()
    {
    var md = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"))

    md = Vector2.Scale(md, new Vector2(sensitivity * smoothing, sensitivity * smoothing));
    smoothV.x = Mathf.Lerp(smoothV.x, md.x, 1f / smoothing);
    smoothV.y = Mathf.Lerp(smoothV.y, md.y, 1f / smoothing);
    mouseLook += smoothV;

    transform.localRotation = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);
    character.transform.localRotation = Quaternion.AngleAxis(mouseLook.x, character.transform.up);
    }
    }
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    You missed a semi colon at the end of the previous line. :)
     
  3. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
  4. LiableDuke

    LiableDuke

    Joined:
    Feb 8, 2018
    Posts:
    33
    OMG I am an idiot thank you.
     
  5. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    No worries, you're welcome :)