[AddComponentMenu("NGUI/Examples/Spin With Mouse")]

publicclass SpinWithMouse : MonoBehaviour

{

publicTransform target;

public float speed = 1f;

 

Transform mTrans;

 

void Start ()

{

mTrans = transform;

}

 

void OnDrag (Vector2 delta)

{

//NUIG 鼠标或手机,点击事件为空。后再进行transform rotation

UICamera.currentTouch.clickNotification = UICamera.ClickNotification.None;

 

if (target != null)

{

target.localRotation = Quaternion.Euler(0f, -0.5f * delta.x * speed, 0f) * target.localRotation;

}

else

{

mTrans.localRotation = Quaternion.Euler(0f, -0.5f * delta.x * speed, 0f) * mTrans.localRotation;

}

}

}

相关文章:

  • 2021-04-07
  • 2021-08-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
猜你喜欢
  • 2021-06-21
  • 2021-07-08
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
相关资源
相似解决方案