- //压力的取值在0F-6.xF之间,我们测试4F是个不错的力度
- c**t float PRESSURE_MAX = 4F;
- void Update ()
- {
- if (Input.touchPressureSupported) {
- if (Input.touchCount > 0) {
- Touch touch = Input.GetTouch (0);
- if (touch.pressure >= PRESSURE_MAX) {
- //触发3dtouch
- }
- }
- }
- #if UNITY_EDITOR
- //editor下用鼠标右键来模拟
- if (Input.GetMouseButtonDown (1)) {
- } else if (Input.GetMouseButtonUp (1)) {
- } else if (Input.GetMouseButton (1)) {
- }
- #endif
- }
复制代码
|
|
|
|
|