Unity

WER

CTRL +  D复制

双击左边 和 F 以选中物体为中心显示


clobal local

y轴 up

z轴 forward

x轴 right 


transform

void Start()

{

    Debug.Log("开始测试");

    GameObject obj = this.gameObject;

    string name = obj.name;

    Debug.Log("物体名称:" + this.gameObject.name);

    Transform tr = this.gameObject.transform;

    Vector3 pos = this.gameObject.transform.position;

    Debug.Log("物体位置:" + pos.ToString("f3"));

    obj.transform.position = new Vector3(0, 0, 0);

    obj.transform.localPosition = new Vector3(0, 0, 0);


Application.targetFrameRate = 60;//尽量以60来更新帧率


}

void Update() // 更新游戏状态

{

    Debug.Log("upate:" + Time.time);

Debug.Log("upate:" + Time.deltaTime);//与上一次的时间间隔


//使用deltaTime 让物体匀速运动

float speed = 1;

float distance = speed * Time.deltaTime;


//让物体运动

Vector3 pos = this.transform.localPosition;

pos.x -= distance; //0.1f;

this.transform.localPosition = pos;

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容