Basic use unity plugins in EasyTouch

1 About two way EasyTouch of
the 4.x version, you need to create in the Hierarchy EasyTouch, do not need five versions, suggestions created.
①4.x version:

using System.Collections;
using System.Collections.Generic;
using HedgehogTeam.EasyTouch;
using UnityEngine;
public class ESTCTset : MonoBehaviour {
    private void OnEnable () {
        EasyTouch.On_TouchStart += OnTouchStart;
        EasyTouch.On_TouchUp += OnTouchEnd;
        EasyTouch.On_Swipe += OnSwipe;
    }ipe -= OnSwipe;
    }

    private void OnDisable () {
        EasyTouch.On_TouchStart -= OnTouchStart;
        EasyTouch.On_TouchUp -= OnTouchEnd;
        EasyTouch.On_Sw
    private void OnDestroy () {
        EasyTouch.On_TouchStart -= OnTouchStart;
        EasyTouch.On_TouchUp -= OnTouchEnd;
        EasyTouch.On_Swipe -= OnSwipe;
    }
    void OnTouchStart (Gesture gesture) {
        Debug.Log ("OnTouchStart");
        Debug.Log ("ActionTime" + gesture.startPosition);

    }
    void OnTouchEnd (Gesture gesture) {
        Debug.Log ("OnTouchEnd");
        Debug.Log ("ActionTime" + gesture.actionTime);
    }
    void OnSwipe (Gesture gesture) {
        Debug.Log ("OnSwipe");
        Debug.Log ("Type" + gesture.swipe);
    }
}

②5 version

using System.Collections;
using System.Collections.Generic;
using HedgehogTeam.EasyTouch;
using UnityEngine;

public class ESTC5 : MonoBehaviour {
    // Start is called before the first frame update
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        Gesture currentGesture = EasyTouch.current;
        if (currentGesture != null && EasyTouch.EvtType.On_TouchStart == currentGesture.type) {
            OnTouchStart (currentGesture);
        }
        if (currentGesture != null && EasyTouch.EvtType.On_TouchUp == currentGesture.type) {
            OnTouchEnd (currentGesture);
        }
        if (currentGesture != null && EasyTouch.EvtType.On_Swipe == currentGesture.type) {
            OnSwipe (currentGesture);
        }
    }
    void OnTouchStart (Gesture gesture) {
        Debug.Log ("OnTouchStart");
        Debug.Log ("ActionTime" + gesture.startPosition);

    }
    void OnTouchEnd (Gesture gesture) {
        Debug.Log ("OnTouchEnd");
        Debug.Log ("ActionTime" + gesture.actionTime);
    }
    void OnSwipe (Gesture gesture) {
        Debug.Log ("OnSwipe");
        Debug.Log ("Type" + gesture.swipe);
    }
}

2 Note ctrl, alt of two fingers to imitate

3 For quick gesture, if you have such similar options allow over me
as pinch (zoom) to a property is a gesture over me, if you check this must have an impact, otherwise unable to detect whether the finger on the object, without hook is selected, the normal use, it is not necessary to detect whether the touch.

Note 4 quick gesture in the pinch and twist at the same time and if there is to be a trigger end event, the two will clash
of the plug-in author's solution: to switch the logic required by
EasyTouch.SetEnablePinch (to true);
EasyTouch.SetEnableTwist (false);

5 properties on EasyTouch inspector of
①unity remote: is a remote debugging feature, download the phone app, and connect with pc data line, to help us debugging on pc.

②: gui compatibility (ui capacitive: If checked, easytouch not respond to events on the ugui (except On_OverUIElement this event), it is solely responsible for ugui, if not checked, can respond EasyTouch.
③: enable Unity deteciton : whether to allow UI testing, if unchecked, he would ignore the UI layer, penetrate it to pick up Ui things behind.

Enumerated type:
EasyTouch.GesturePriority: gesture preference value
EasyTouch.SwipeDirection: gesture sliding direction
6EasyTouch event
On_Cancel: When the system can not be traced to the finger, the finger is off the screen will call this event.
On_Cancel2Fingers: When the two-finger gesture, a finger will be called upon to leave

EasyTouch对层处理:
LayerMask mask = EasyTouch.Get3DPickableLayer();
EasyTouch.Set3DPickableLayer(mask);

Multi-camera processing:
EasyTouch.AddCamera (CAM, false); The second parameter is the meaning is not ugui rendering camera, false that is not

Gesture Gesture;
gesture.fingerIndex: a first finger is 0, the second 1, represented by -1 if the current operation is a two-finger
Gesture.GetTouchToWorldPoint (vector3 position); may be the position of the target current world coordinates, may be this calculated point to the camera length

Released four original articles · won praise 1 · views 1328

Guess you like

Origin blog.csdn.net/obf2018/article/details/105234502