News: Enjoy our Christmas offer 30% off on our latest package Tower Defense Level Kit http://u3d.as/m7h

  • November 21, 2018, 05:47:15 AM

Login with username, password and session length

Recent Posts

Pages: [1] 2 3 ... 10
1
EasyTouch / Multiple gesture scripts all triggering at the same time - help!!!
« Last post by cstobler on October 03, 2018, 09:45:33 PM »
Hi,

I don't know if this question has been asked before or not, I wasn't sure how to search for this issue, but I will describe it as best as I can.

We are creating a Myst-style first-person adventure game. Our scenes are setup in Unity 2D, with each pre-rendered background as a rectangular sprite, with a separate camera facing each one. I am trying to implement EasyTouch into it so that mobile players can swipe left or right to switch cameras (using separate asset for camera transitions; it is working fine). Each background sprite has a 2D box collider so it can detect the swipes.

My issue is that when I attach my swipe script to a background, for whatever reason, it will detect a swipe whether my mouse is over that collider/background or not. The result is that it will trigger 5 times if I have 5 backgrounds in my scene, even if I am only looking at one of them through the game view.

What am I doing wrong? How do I set this so that it will only trigger when my mouse is over the current background?

Let me know if I need to provide more info. I will include my gesture script below in case that will help (as you will see below, I tried .IsOverGUI to see if that would work. It did not.):

Code: [Select]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using CameraTransitions;
using HedgehogTeam.EasyTouch;

public class NavScriptTest : MonoBehaviour {

    public Camera camOrig;
    public Camera camLeft;
    public Camera camRight;
    public CameraTransition cameraTransition;
    public float transSpeed;

    private void OnEnable()
    {
        if (cameraTransition == null)
        {
            cameraTransition = GameObject.FindObjectOfType<CameraTransition>();
        }
    }

    // Update is called once per frame
    void Update () {

        // Get current gesture
        Gesture currentGesture = EasyTouch.current;

        if (currentGesture.type == EasyTouch.EvtType.On_SwipeEnd)
        {
            //if (currentGesture.isOverGui)
           //{
                if (currentGesture.swipe == EasyTouch.SwipeDirection.Left)
                {
                    Debug.LogWarning("Left Swipe Successful!");
                    cameraTransition.DoTransition(CameraTransitionEffects.SmoothLine, camOrig, camRight, transSpeed,
                                      new object[] { 90.0f, 0.1f });
                }
                else if (currentGesture.swipe == EasyTouch.SwipeDirection.Right)
                {
                    Debug.LogWarning("Right Swipe Successful!");
                    cameraTransition.DoTransition(CameraTransitionEffects.SmoothLine, camOrig, camLeft, transSpeed,
                                  new object[] { 90.0f, 0.1f });
                }
            //}
        }
    }
}

Thanks,

Charlie
2
EasyTouch / QuickGesture on Parent GameObject
« Last post by sunfire91 on September 11, 2018, 02:29:20 PM »
What is the best way to use quick gesture (eg. quick drag) on a parent gameobject with children with different colliders?

Also, I notice sometimes the gameobject is stuck and dragging doesn't move them. However, if I move them a little bit on the editor when they got stuck, they are draggable again. What could be the problem?

Thanks!
3
EasyTouch / Detecting Touchpad's events through code
« Last post by Se7dev on July 03, 2018, 05:52:10 PM »
How would I go about detecting touchpad's events through code, something like this:

Code: [Select]
    public void Update()
    {
        Touchpad.OnTouchStart
        {
            DoStuff();
        }
    }
4
EasyTouch / Quick Drag with Grid Snap
« Last post by wagenheimer on June 27, 2018, 12:01:50 PM »
Is there any example of using Quick Drag with Grid Snapping? I tried some different approaches but not of them worked.

Thanks
5
EasyTouch / Quick Fix for EasyTouch Mouse Controls
« Last post by arandono on May 17, 2018, 01:52:42 AM »
I've been using the EasyTouch trackpad controls for desktop builds. Everything had been working well except for one thing that was causing problems. On Mac laptops, you can allow for tap-to-click gestures where you just lightly tap the touchpad without actually clicking the trackpad. This was causing issues on my desktop build because EasyTouch was registering a On_TouchStart event but not registering an On_TouchUp event. As a consequence, On_TouchDown was being called every frame after a tap-to-click event (even after the user had stopped touching the trackpad completely) which wouldn't stop until the next touch event occurred.

I did some Debuging and found that it only occurred in instances where OnMouseButtonDown and OnMouseButtonUp were called in the same frame. In this case, OnMouseButtonUp was called before On_TouchStart, so EasyTouch never received information that the touch event had ended.

I found a quick fix: in EasyTouch.Update Touches there's a code block
      
      else{
         int i=0;
         while (i<touchCount){
            fingers = input.GetMouseTouch(i,fingers) as Finger;
            fingers.touchCount = touchCount;
            i++;
         }         
      }

which I replaced with

  else if(!(Input.GetMouseButtonUp(0) && Input.GetMouseButtonDown(0))){
                int i=0;
                while (i<touchCount){
                    fingers = input.GetMouseTouch(i,fingers) as Finger;
                    fingers.touchCount = touchCount;
                    i++;
                }           
            }

This seemed to work. Haven't tested it thoroughly and if there's a better workaround, I'd love to hear it!
6
EasyTouch / Easytouch in Pixel/Screen Space Only
« Last post by ferretnt on April 25, 2018, 08:14:38 PM »
Hi,

We've shipped many games/apps with Easytouch previously, but because everything we do has very complex multi view/camera/rendertexture setups, we've always had to hack things around to get gestures recognized. Things we've had to do have included:

- Adding colliders behind cameras just to make sure raycasts hit something.
- Adding/removing cameras from the easytouch cameras array at runtime.
- Handling our own raycasts, as usually gesture.PickedObject isn't what we wanted / from the right camera / etc.

Is there any way we can use Easytouch completely in screen space as a 2D gesture detector, and handle all our own 3D raycasting/picking/etc? We're currently evaluating Fingers Touch Gestures for a new app we're building from scratch, because it seems closer to this use case, but since EasyTouch has served us well enough so we'd like to confirm if there's an easy way just to have EasyTouch pretty much ignore the 3D world and focus on 2D screenspace gesture recognition.
7
Problem with EasyTouch? / Tons of errors on startup
« Last post by MBoffin on March 18, 2018, 07:52:02 PM »
On a brand new project, I'm getting a ton of these errors when starting up:
Quote
GetBool is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'EasyTouchWelcomeScreen'.
From searching around, this is a problem that's still waiting to be fixed. Any update on when this will get fixed? It's a lot of errors:

8
Problem with EasyTouch? / Mouse + Touch Support
« Last post by karonte on February 16, 2018, 01:49:50 PM »
Hi guys!
I'm working on a software that has to be compatible both with touch and mouse inputs.
Since i need to move and rotate several 3D objects in the scene, i thought of doing somethig like this:

- for moving the obj: a simple drag on the obj. No problems here, Easytouch handles perfectly both mouse and touch.
- for rotation, when using a mouse: a right click drag on the obj
- for rotation, when using touch: a twist on the obj

In conclusion: i need to differentiate between left and right mouse buttons, clicks, drags. Plus, i need the whole Easytouch system (i'm already using drag2fingers and Pinches to move the camera, and other things). So I thought of using both the normal Unity Eventsystem and Easytouch, together.

The problem is: as soon as I add a Unity Graphic Raycaster to the camera, i suddenly cannot receive any Easytouch event on the objs anymore. If i mask them on a non raycastable layer they work again, but i cannot use them with the basic Eventsystem. It looks like the Raycaster is overriding the Easytouch system.

What to do? Any suggestions?
I'm fine using only Easytouch if possibile, but i really need to differentiate left clicks/right clicks/wheelscrolls, drag/clicks on single objects or outside them.
9
Problem with EasyTouch? / Re: EasyTouchWelcomeScreen won't show up
« Last post by Nicolas on February 08, 2018, 08:44:59 AM »
Hi,

Do you have update your version ?
10
Problem with EasyTouch? / Re: EasyTouchWelcomeScreen won't show up
« Last post by SunJay on January 30, 2018, 02:53:35 PM »
Hi it's still not working for me
Pages: [1] 2 3 ... 10