Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Errors??

Discussion in 'Scripting' started by andersdk98, Oct 12, 2015.

  1. andersdk98

    andersdk98

    Joined:
    Feb 3, 2015
    Posts:
    11
    Hey there!
    I am really stuck, I don't know what to do with these errors, can someone in here help please?
    Thanks in advance <3 <3

     
  2. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    The rigid body ones are self explanatory. The way you use it in scripts change so you just need to update it from what it says now to what the error is saying. Usually it updates automatically but obviously didn't in this instance. Fix them first then see what errors happen next.
     
  3. andersdk98

    andersdk98

    Joined:
    Feb 3, 2015
    Posts:
    11
    I found a guy who had the same problem as me, and this script worked for me:

    #pragma strict

    var rotationSpeed = 100;
    var jumpHeight = 8;

    private var isFalling = false;

    function Update ()
    {
    //Handle ball rotation
    var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed;
    rotation *= Time.deltaTime;
    GetComponent.<Rigidbody>().AddRelativeTorque (Vector3.back * rotation);

    //Handle ball jump
    if (Input.GetKeyDown(KeyCode.W) && isFalling == false)
    {
    GetComponent.<Rigidbody>().velocity.y = jumpHeight;
    isFalling = true;
    }
    }

    function OnCollisionEnter ()
    {
    isFalling = false;
    }

    ...
    Thanks anyways!