unity3d 触屏拖拽物体代码
2015-11-19 10:15
337 查看
public float speed = 0.1f; void Update() { if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) { Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition; transform.Translate(touchDeltaPosition.x * speed, touchDeltaPosition.y * speed, 0); } }
相关文章推荐
- unity3d 陀螺仪代码
- [Unity]面试题整理
- unity3d 5.2 添加广点通广告
- Unity杂记
- Unity3d 支持的图形格式和大小优化
- Surface Shader Lighting Examples
- Custom Lighting models in Surface Shaders
- [Shader] UnityShader系列---黑与白
- 【Unity开发】NGUI,UGUI按钮监听的动态添加与移除
- Unity着色器常用关键字及属性
- Unity ShaderLab学习总结
- 交换机安全
- Unity3d 前端与后端之间的数据交互
- unity3d OnMouseDown()函数没被调用
- 【NGUI】Unity中给NGUI添加监听事件,Button,Toggle
- Unity 画图效果
- 在unity中不销毁物件
- Unity3d·小技巧·左上角小文字窗口
- Unity3d-输入-Input
- unity 3D在调用JsonFx遇到的问题及解决