您的位置:首页 > 编程语言

插入代码测试

2015-07-22 10:35 309 查看
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 上下左右旋转脚本。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: