using UnityEngine;using System.Collections;using System.Collections.Generic;public class L12 : MonoBehaviour{ public float moveSpeed = 10f; void Start() { } // Update is called once per frame void Update() { //自定义移动 transform.Translate(new Vector3(1, 0, 0)); //可以不输入数值,控制移动 transform.Translate(Vector3.up * moveSpeed * Time.deltaTime); //可以不输入数值,控制旋转 transform.Rotate(Vector3.up * moveSpeed * Time.deltaTime); //以上Vector3.* 的快捷键操作应用于局部轴,而不是世界轴。 //如果想用碰撞体移动某个对象,则不应该使用Translate 和 Rotate 函数,而应该考虑使用 Physics 函数 }}