#pragma strict
var np:GameObject;
function Start () {
// 动态创建也可以
//np = GameObject.CreatePrimitive(PrimitiveType.Cube);
}
function Update () {
if(Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D)){
np.transform.localRotation = Quaternion.identity;
print('dddddddd');
}
if(Input.GetKey(KeyCode.A)){
np.transform.Rotate(0,0,-5);
//np.transform.Instantiate(np,Vector3(0.3,1,0.5),Quaternion.identity);
}
if(Input.GetKey(KeyCode.D)){
np.transform.Rotate(0,0,5);
}
if(Input.GetKey(KeyCode.W)){
np.transform.Rotate(-5,0,0);
}
if(Input.GetKey(KeyCode.S)){
np.transform.Rotate(5,0,0);
}
if(Input.GetKey(KeyCode.Q)){
np.transform.localScale += new Vector3(0.1F, 0.1F, 0.1F);
}
if(Input.GetKey(KeyCode.E)){
np.transform.localScale -= new Vector3(0.1F, 0.1F, 0.1F);
}
}
转载于:https://my.oschina.net/uvvv/blog/665482