码迷,mamicode.com
首页 > 其他好文 > 详细

摄像机位置调节

时间:2015-04-01 23:25:55      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:

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;        
    }    
}

 

摄像机位置调节

标签:

原文地址:http://www.cnblogs.com/943711466qq/p/4385614.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!