public class Rotation_t: MonoBehaviour {
public int speed=100;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
//第三个参数不加的话默认为 Space.Self
if (Input.GetKey(KeyCode.A)) {
transform.Rotate(Vector3.up,speed*Time.deltaTime,Space.World);
}
if (Input.GetKey(KeyCode.D)) {
transform.Rotate(Vector3.down,speed*Time.deltaTime,Space.World);
}
if (Input.GetKey(KeyCode.W)) {
//这里采用了rotate 函数的另外一种参数写法,两个参数,同样。第二个参数不指定的话默认为self
transform.Rotate(Vector3.right*speed*Time.deltaTime,Space.World);
}
if (Input.GetKey(KeyCode.S)) {
transform.Rotate(Vector3.left*speed*Time.deltaTime,Space.World);
}
}
}
看这次还会不会再 乱码。。。。。
unity按WSAD 上下左右旋转脚本。