Search Unity

Need a simple help here about moving up and down

Discussion in 'AR' started by ThunderX, May 31, 2020.

  1. ThunderX

    ThunderX

    Joined:
    May 31, 2020
    Posts:
    1
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class Myfile : MonoBehaviour
    {
    float speed = 50.0f;
    float speed1 = -50.0f;
    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
    if (Input.GetKey("d")) transform.Rotate(Vector3.up * speed * Time.deltaTime);
    if (Input.GetKey("a")) transform.Rotate(Vector3.up * speed1 * Time.deltaTime);
    }
    }


    So this what I made but still am confuse how to make it go up and down with Input key of W or S ?