【Unity】unity3d FingerGestures 单点 多点触摸 手势

2025-05-11 03:31:28

FingerGestures最大的好处就是结合unity3d进行多点触控,手势识别,编写一次代码 ,通过配置来进行多平台发布

FingerGestures提供了3种不同的方法来检测由用户执行的拖动手势。

方法1:使用默认的手势事件

每个手指的手势事件:为每个单独的手指,独立的状态

OnFingerTap 轻敲

OnFingerDoubleTap

OnFingerSwipe 猛击

OnFingerLongPress 长按

OnFingerDragBegin,OnFingerDragMove,OnFingerDragEnd 拖曳

全局手势事件:

当一个手指触摸屏幕上:

OnTAP

OnDoubleTap

OnSwipe

OnLongPress

OnDragBegin,OnDragMove,OnDragEnd

两个手指触摸屏幕时:

OnPinchBegin,OnPinchMove,OnPinchEnd 捏,夹

OnRotationBegin,OnRotationMove,OnRotationEnd 旋转

OnTwoFingerTap

OnTwoFingerSwipe

OnTwoFingerLongPress

OnTwoFingerDragBegin,OnTwoFingerDragMove,OnTwoFingerDragEnd

方法2:使用一个DragGestureRecognizer 一种识别器

方法3:使用“工具箱”

工具箱是一种更高级方便的方式,设计的理念是开箱就用,包括了很多脚本,但是没有涉及到核心源码,所以不用的话 可以把这个包直接删掉

FingerGestures 的事件注册是基于c#的,性能还是可以

FingerGestures is a scripting package forUnity that lets you easily detect and react to common input gesturesperformed with either a mouse or a touch screen device, using one or more fingers.

Main Features

Single and multi-finger gesture recognizers for Drag, Tap, Swipe, Long-Press, Pinch, Rotate 单和多手指的拖曳、自来水、刷卡、长按、捏、旋转,等手势识别 Finger events: Down, Up, Move, Stationary 手指事件:按下、弹起、移动、固定。 An easy and smooth integration with Unity’s workflow 它能简单而平滑的与“unity的工作流式”整合 A straightforward and streamlined event-driven API to quickly get started without digging too deep 这是一套简明合理的事件驱动API,无需深究就能快速上手 A rich and powerful object-oriented gesture framework for maximum control 为最大的操控而提供的,一个丰富而强大的面向对象的手势框架 An efficient, low memory usage implementation 一种高效,低内存占用的实施方案 Finger/Touch abstraction: mouse and touchscreen inputs go through the same pipe! A Toolbox packed with no-coding-required & ready-to-use scripts including: 手指/触摸抽象:鼠标和触摸屏输入,通过相同的管道! Drag & drop system 拖放系统 Smooth orbit camera using drag and pinch gestures to rotate, zoom and pan 平滑的轨道相机使用通过:拖放和捏的手势来旋转、缩放和平移 Pinch-Zoom camera 捏变焦相机

Several easy-to-follow sample scenes that will progressively introduce you to the libraryWorks on desktop, iOS and Android platformsSupport for both Javascript and C#Includes full C# source code with comments and online documentation

几个易于遵循的示例场景,将逐步向您介绍的这个库如何工作在:桌面、iOS和Android平台上。并支持同时JavaScript和C#。并包括完整的包含注释的C#源代码和在线文档。

来自:unity3d工作室http://cl314413.blog.163.com/blog/static/19050797620127292023453/

Copyright © 2022 世界杯预选赛欧洲区_世界杯在哪个国家举行 - kd896.com All Rights Reserved.