签名
叶凡
22GS

[技术干货] Unity3D技术之3DTouch实现111

[复制链接]

Unity3D技术之3DTouch实现111

发表于 2023-1-3 11:47:46 来自 技术干货 阅读模式 倒序浏览
506 0 查看全部
  1.         //压力的取值在0F-6.xF之间,我们测试4F是个不错的力度
  2.         c**t float PRESSURE_MAX = 4F;
  3.         void Update ()
  4.         {
  5.             if (Input.touchPressureSupported) {
  6.                 if (Input.touchCount > 0) {
  7.                     Touch touch = Input.GetTouch (0);
  8.                     if (touch.pressure >= PRESSURE_MAX) {
  9.                         //触发3dtouch
  10.                     }
  11.                 }
  12.             }
  13.             #if UNITY_EDITOR
  14.             //editor下用鼠标右键来模拟
  15.             if (Input.GetMouseButtonDown (1)) {
  16.             } else if (Input.GetMouseButtonUp (1)) {
  17.             } else if (Input.GetMouseButton (1)) {
  18.             }
  19.             #endif
  20.         }
复制代码


回复

使用道具 举报

游客~
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|极客同行 ( 蜀ICP备17009389号-1 )川公网安备 51019002006459号

© 2013-2016 Comsenz Inc. Powered by Discuz! X3.4