Unity3D学习记录——物体旋转

来源:互联网 发布:淘宝网钓鱼竿 编辑:程序博客网 时间:2024/04/26 18:00
using System.Collections;using System.Collections.Generic;using UnityEngine;public class Rotate : MonoBehaviour {    private Transform m_transform;// Use this for initializationvoid Start () {        m_transform = gameObject.GetComponent<Transform>();}// Update is called once per framevoid Update () {        if (Input.GetKey(KeyCode.Q)) {            m_transform.Rotate(Vector3.down * 10 * Time.deltaTime);        }        if (Input.GetKey(KeyCode.E)) {            m_transform.Rotate(Vector3.up * 10 * Time.deltaTime);        }}}

原创粉丝点击