国产成人v爽在线免播放观看,日韩欧美色,久久99国产精品久久99软件,亚洲综合色网站,国产欧美日韩中文久久,色99在线,亚洲伦理一区二区

學(xué)習(xí)啦>學(xué)習(xí)電腦>電腦硬件知識>鍵盤鼠標(biāo)>

unity3d實現(xiàn)鼠標(biāo)拖拽旋轉(zhuǎn)

時間: 沈迪豪908 分享

  怎么實現(xiàn)unity3d 鼠標(biāo)拖拽旋轉(zhuǎn),滾輪縮放的功能呢?下面是學(xué)習(xí)啦小編收集整理關(guān)于unity3d 鼠標(biāo)拖拽旋轉(zhuǎn),滾輪縮放的功能的資料以供大家參考學(xué)習(xí),希望大家喜歡。

  unity3d 鼠標(biāo)拖拽旋轉(zhuǎn),滾輪縮放的功能的詳細(xì)代碼

  var target : Transform;

  var xSpeed = 250.0;

  var ySpeed = 120.0;

  var yMinLimit = -20;

  var yMaxLimit = 80;

  var initDis = 20;

  var minDis = 3.0;

  var maxDis = 50.0;

  var wheelSpeed = 5;

  static var x = 0.0;

  static var y = 0.0;

  static var distance;

  private var position;

  private var rotation;

  function Start () {

  x = 130;

  y = 30;

  transform.rotation = Quaternion.Euler(y, x, 0);;

  transform.position = Quaternion.Euler(y, x, 0) * Vector3(0.0, 0.0, -initDis) + target.position;

  // Make the rigid body not change rotation

  if (rigidbody)

  rigidbody.freezeRotation = true;

  }

  function Update () {

  if (target) {

  distance = Vector3.Distance(target.position,transform.position);

  if(Input.GetMouseButton(1)){

  x += Input.GetAxis("Mouse X") * xSpeed * 0.02;

  y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02;

  y = ClampAngle(y, yMinLimit, yMaxLimit);

  }

  distance-= Input.GetAxis("Mouse ScrollWheel")*wheelSpeed;//獲取鼠標(biāo)中建響應(yīng)

  distance = Mathf.Clamp(distance,minDis,maxDis);//距離取最大值和最小值

  rotation = Quaternion.Euler(y, x, 0);

  position = rotation * Vector3(0.0, 0.0, -distance) + target.position;

  transform.rotation = rotation;

  transform.position = position;

  }

  }

  static function ClampAngle (angle : float, min : float, max : float) {

  if (angle < -360)

  angle += 360;

  if (angle > 360)

  angle -= 360;

  return Mathf.Clamp (angle, min, max);

  }

鼠標(biāo)拖拽相關(guān)文章:

1.Win7鼠標(biāo)拖拽操作是什么

2.電腦鼠標(biāo)不能拖拽怎么辦

3.360瀏覽器怎么選擇鼠標(biāo)拖放的搜索引擎

4.電腦鼠標(biāo)拖動不連貫怎么辦

5.jst實現(xiàn)鼠標(biāo)拖動選擇功能

6.筆記本觸摸鼠標(biāo)怎么拖動

7.鼠標(biāo)不能上下拖動怎么解決

1998195