943711466qq

摄像机位置调节

private var addHeight  = false;
private var minusHeight = false;

 


function LateUpdate () {
    Apply (transform, Vector3.zero);
    distance =( Time.deltaTime*Input.GetAxis("Mouse ScrollWheel")*20 +1)* distance;    
    if (Input.GetKeyDown(KeyCode.PageUp)){
        addHeight = true;
    }
    if (Input.GetKeyUp(KeyCode.PageUp)){
        addHeight = false;
    }        
    if (Input.GetKeyDown(KeyCode.PageDown)){
        minusHeight = true;
    }
    if (Input.GetKeyUp(KeyCode.PageDown)){
        minusHeight = false;
    }
    if (addHeight){
        height = height + Time.deltaTime * 10;
    }
    if (minusHeight && height >=0){
        height = height - Time.deltaTime * 10;        
    }    
}

 

分类:

技术点:

相关文章:

  • 2021-04-12
  • 2022-12-23
  • 2021-11-17
  • 2021-08-24
  • 2021-11-04
  • 2021-08-18
  • 2021-07-13
猜你喜欢
  • 2022-12-23
  • 2021-04-22
  • 2021-09-07
  • 2021-11-13
  • 2021-10-17
  • 2021-11-04
相关资源
相似解决方案