Search Unity

Help! Simple Script Error

Discussion in 'Scripting' started by apass18, Sep 20, 2014.

  1. apass18

    apass18

    Joined:
    Sep 20, 2014
    Posts:
    4
    var turnSpeed : float = 2;
    var forwardSpeed : float = 3;

    functionUpdate ()
    {
    var forwardMoveAmount = Input.GetAxis("Vertical")*forwardSpeed;

    var turnAmount = Input.GetAxis("Horizontal")*turnSpeed;

    transform.Rotate(0,turnAmount,0);
    }


    Whats Wrong Here??
     
  2. kodagames

    kodagames

    Joined:
    Jul 8, 2009
    Posts:
    548
    whats the error?
     
  3. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    Code (JavaScript):
    1. functionUpdate ()
    should be
    Code (JavaScript):
    1. function Update ()
     
  4. BmxGrilled

    BmxGrilled

    Joined:
    Jan 27, 2014
    Posts:
    239
    Also might want to scale turnAmount by Time.deltaTime: e.g. transform.Rotate(0,turnAmount * Time.deltaTime,0);
    Otherwise it's gonna be extremely fast turning/spinning.

    Hope this helps! :)
     
  5. apass18

    apass18

    Joined:
    Sep 20, 2014
    Posts:
    4
    Thanks
    :)