Search Unity

CS1502/CS1503

Discussion in 'Scripting' started by Zoneo, Jul 11, 2015.

  1. Zoneo

    Zoneo

    Joined:
    May 1, 2015
    Posts:
    85
    Hey guys,
    I'm following a youtube tutorial and i think my code is out dated... my code matches his but its giving me the 1502 and 1503 error codes. any thoughts?

    Code (csharp):
    1.  
    2. Transform player;
    3.     Quaternion targetLook;
    4.     Vector3 targetMove;
    5.     public float smoothLook = 0.5f;
    6.     public float smoothMove = 0.5f;
    7.     public float distFromPlayer = 5;
    8.     public float heightFromPlayer = 3;
    9.  
    10.     void Start () {
    11.  
    12.         player = GameObject.FindWithTag ("Player").transform;
    13.     }
    14.  
    15.  
    16.     void Update () {
    17.  
    18.  
    19.  
    20.         targetMove = player.position + (player.rotation * new Vector3 (0, heightFromPlayer, -distFromPlayer));
    21. //this is where the error code says the problem is.
    22.         transform.position = Vector3.Lerp (transform.position, targetLook, smoothMove * Time.deltaTime);
    23.  
    24.         targetLook = Quaternion.LookRotation (player.position - transform.position);
    25.         transform.rotation = Quaternion.Lerp (transform.rotation, targetLook, smoothLook * Time.deltaTime);
    26.  
    27.  
    Assets/Chapter 2/_Scripts/CameraScript.cs(25,46): error CS1503: Argument `#2' cannot convert `UnityEngine.Quaternion' expression to type `UnityEngine.Vector3'

    Assets/Chapter 2/_Scripts/CameraScript.cs(25,46): error CS1502: The best overloaded method match for `UnityEngine.Vector3.Lerp(UnityEngine.Vector3, UnityEngine.Vector3, float)' has some invalid arguments
     
  2. HiddenMonk

    HiddenMonk

    Joined:
    Dec 19, 2014
    Posts:
    987
    You have targetLook instead of targetMove in your code here
    Code (CSharp):
    1. transform.position = Vector3.Lerp (transform.position, targetLook, smoothMove * Time.deltaTime);
    you lied about having it exactly the same !!!!!! ^_^ (or maybe the guy in the video made the error and fixes it later in the vid)

    the console should have given a warning like "targetMove was assigned, but not used" or something.
     
  3. Zoneo

    Zoneo

    Joined:
    May 1, 2015
    Posts:
    85
    These little details i keep over looking is getting old lol i gotta start paying more attention to what i code lol thanks
     
    HiddenMonk likes this.