【帅刺猬】用鼠标Wheel中键控制对象的缩放

  1. //初始化设置为1.0
  2. var size = 1.0;
  3. //在每一帧的更新中检测鼠标中键动作
  4. function Update () {
  5. //测试一个Cube,找到Cube对象
  6.   var cube = GameObject.Find("Cube");
  7. //检测是否有鼠标滚动事件
  8.         if(Input.GetAxis("Mouse ScrollWheel")){
  9.               size += Input.GetAxis("Mouse ScrollWheel");
  10.               cube.transform.localScale=Vector3(1*size,1*size,1*size);
  11.        }
  12. }
You can reach me by surfing the web ---- huntjobs.cn,or sending e-mails to me,Here is my qq MailBox:1424870395@qq.com
原文地址:https://www.cnblogs.com/HedgehogBlog/p/4587836.html