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

Unit 1 Quiz 9 error?

Discussion in 'Community Learning & Teaching' started by Lednar, Nov 13, 2019.

  1. Lednar

    Lednar

    Joined:
    Jan 9, 2018
    Posts:
    14
    In Unit 1 there is Quiz in the end. There is written In the Question 9 a code:

    horizontalInput = Input.GetAxis("Horizontal");
    transform.Rotate(Vector3.up, horizontalInput);


    In Rotate there should be * not , ? After comma there can be only Space.Self and Space.World?

    Maybe I can also add the link to Quiz: https://learn.unity.com/quiz/quiz-1-9s
     
  2. APSchmidtOfOld

    APSchmidtOfOld

    Joined:
    Aug 8, 2016
    Posts:
    4,473
    Hey, thank you for the link! I didn't know this quiz existed.

    This said, I don't understand your question. One of the provided choices describes perfectly the movement.
     
  3. Lednar

    Lednar

    Joined:
    Jan 9, 2018
    Posts:
    14
    Thank you for answer. The reference says that Transform.Rotate is defined as:

    public void Rotate(Vector3 eulers, Space relativeTo = Space.Self);


    but in Quiz code
    horizontalInput
    value is a float between -1 and 1, not Space type variable. After comma there can be only Space.Self or Space.World as reference is saying to me.
    Maybe it shouldn't be comma but multiplayer in Quiz 9 like so:

    transform.Rotate(Vector3.up * horizontalInput);
     
  4. APSchmidtOfOld

    APSchmidtOfOld

    Joined:
    Aug 8, 2016
    Posts:
    4,473
    Sometimes digging too deeply in the reference (the documentation) is a bad idea, especially since their descriptions are awfully technical.

    The code provided in the quiz works perfectly and does what it's intended to do, so, I don't know what else say. Did you try the example provided in Unity to see what happens (and get the answer to the question at the same time :p)?