Search Unity

New Developer...i need help with this: How to make a Cube rotate by 90° to the left and right?

Discussion in 'Getting Started' started by ITSLEO, Jul 16, 2018.

  1. ITSLEO

    ITSLEO

    Joined:
    Jun 27, 2017
    Posts:
    1
    I watched several tutorials, used several scripts around the internet and this little motherfucker still gives me errors...basically, my idea is to move to the left and right my cube (the player) by 90° when you press the left and right keys...but i'm not good at all at coding, so i need help. Thanks in advance to who will help me :)

    yes, i alredy tagged the cube as player.

    How to code this so?
     
  2. CyberInteractiveLLC

    CyberInteractiveLLC

    Joined:
    May 23, 2017
    Posts:
    307
    Void Update()
    {
    Float horInput = Input.GetAxis("Horizontal");
    Transform.Rotate(0, horInput * 10 * Time.deltatime, 0);
    }
     
  3. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    If you would like a better outcome, you might want to toss out the 'I can figure this out on my own' mindset and complete (not just view) several of the projects in the Learn section Unity provides for free. If you had, you probably wouldn't have to have asked your question in the first place. There are no shortcuts, if you're serious about learning follow the tuts available to you. A few months down the road with some perseverance and determination you can be doing some really cool stuff, all on your own.
     
    BIGTIMEMASTER likes this.
  4. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181

    Yeah. Just get up on the giant's shoulders.

    Figuring out simple things is a waste of time. Let others show you all of the simple things, and then let them show you where the top dogs are today. Then, when you've easily been carried to the front of the pack, you can carry the baton even further.