首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 其他相关 >

Unity3D鼠标滚轮统制摄像机远近

2012-08-29 
Unity3D鼠标滚轮控制摄像机远近//鼠标中间键var MouseWheelSensitivity 5var MouseZoomMin 2var Mou

Unity3D鼠标滚轮控制摄像机远近

//  鼠标中间键var MouseWheelSensitivity = 5;var MouseZoomMin = 2;var MouseZoomMax = 10;

?? 摄像机距离视角中心最近为2,最远为10,鼠标灵敏度为5

// 如果按住滑轮if (Input.GetAxis("Mouse ScrollWheel") != 0) {//Debug.Log(Input.GetAxis("Mouse ScrollWheel"));//Debug.Log(distance);if (normalDistance >= MouseZoomMin && normalDistance <= MouseZoomMax){normalDistance -= Input.GetAxis("Mouse ScrollWheel") * MouseWheelSensitivity;}if (normalDistance < MouseZoomMin){normalDistance = MouseZoomMin;}if (normalDistance > MouseZoomMax){normalDistance = MouseZoomMax;}}

?

热点排行