阅读背景:

使物体围绕中心点转动(可用于电风扇等的旋转)

来源:互联网 
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class fengshan1 : MonoBehaviour {
public int i = 500;
private int p = 2;
public GameObject cubeModel;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    Vector3 center = cubeModel.transform.eulerAngles;
    if (Input.GetKeyDown(KeyCode.P)) {
        p ++;   
    }
    if (p % 2 == 1)
    {
        transform.Rotate(0, i * Time.deltaTime, 0, Space.Self);
    }
    if (p % 2 == 0)
    {
        transform.Rotate(0,0, 0, Space.Self);
    }
}
}
using System.Collections;
using System.Coll



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: