按键
鼠标按键
if (Input.GetMouseButtonDown(0))//左键
{
Instantiate(qiu, Vector3.zero, Quaternion.identity); //复制一个物体
}
if (Input.GetMouseButtonDown(1))//右键
{
Instantiate(qiu, Vector3.one, Quaternion.identity);
}
if (Input.GetMouseButtonDown(2))//中键
{
Instantiate(qiu, Vector3.one*3, Quaternion.identity);
}
键盘按键
物体的wasd的移动
float a = Time.deltaTime * 3;
if (Input.GetKey(KeyCode.A)) //按键A
{
transform.Translate(-a, 0, 0);
}
if (Input.GetKey(KeyCode.D)) //按键D
{
transform.Translate(a, 0, 0);
}
if (Input.GetKey(KeyCode.W)) //按键W
{
transfo