Fullscreen gestures with different collider ignoring needs

Ask for help and post bugs.

Fullscreen gestures with different collider ignoring needs

Postby TobiasW » Wed Aug 30, 2017 2:56 am

Hello!

I'm using TouchCode 9.0. I have a scene with a car and a ring around the car to rotate it.

I'm wondering how to achieve the following:
  • Drag the ring to rotate the car.
  • Pinch anywhere to scale the car.
  • Long tap anywhere EXCEPT the ring around the car to place the car somewhere else.

I got the functionality mostly working, but I can't reconcile my different needs for the fullscreen gestures.

With this hierarchy everything is working, except that long taps are even recognized on the rotation ring:

  • FullscreenLayer with LongTapGesture (for teleporting the car) and ScreenTransformGesture (for pinch scaling)
    • PinnedTransformGesture (for rotating the car)

With this hierachy everything is working, except that pinching is stopped by the rotation ring around the car:

  • FullscreenLayer with LongTapGesture (for teleporting the car) and ScreenTransformGesture (for pinch scaling)
  • PinnedTransformGesture (for rotating the car)

Basically, I want some of my fullscreen gestures ignoring colliders and others not. Is there some way to properly make multiple fullscreen layers, one inside the hierarchy and one outside?

Thanks,
Tobias
TobiasW
 
Posts: 3
Joined: Wed Aug 30, 2017 2:37 am

Re: Fullscreen gestures with different collider ignoring nee

Postby valyard » Wed Aug 30, 2017 1:02 pm

Hm.
It seems that the biggest problem is to stop LongTap from happening.
Most likely you can use a delegate on it (http://touchscript.github.io/docs/html/ ... legate.htm) and just check if the touch comes from the ring in ShouldReceivePointer (http://touchscript.github.io/docs/html/ ... ointer.htm) returning false if it is.
valyard
Site Admin
 
Posts: 434
Joined: Mon Sep 08, 2014 11:57 pm

Re: Fullscreen gestures with different collider ignoring nee

Postby TobiasW » Thu Aug 31, 2017 2:24 am

valyard wrote:Hm.
It seems that the biggest problem is to stop LongTap from happening.
Most likely you can use a delegate on it (http://touchscript.github.io/docs/html/ ... legate.htm) and just check if the touch comes from the ring in ShouldReceivePointer (http://touchscript.github.io/docs/html/ ... ointer.htm) returning false if it is.


Thanks for the suggestion - I'll try that as soon as I can!

I'm wondering if I've understood how hierarchical and parallel objects work with each other.

Hiere is how I understand it right now:
  1. TouchScript will try to find the first object it hits at that Pointer position ordered by TouchLayer, and if on the same TouchLayer, maybe by closeness to camera/overlapping?
  2. If it hits an object, it will check if there is a gesture to start right now.
  3. If there is no gesture to recognize, it will go up in the hierarchy and check if any TouchLayer hits the parent, the parent's parent etc. until it either finds some gesture to start or there is no parent to process anymore. It won't check any object that isn't a parent, a parent's parent etc. of the originally hit object though. (And I have no idea if it just goes up the hierarchy or if it still sorts by TouchLayer/closeness to camera/overlapping?)
Is that an accurate description of how it works?

Is there a part of the documentation I can read to get a better grasp of this?
TobiasW
 
Posts: 3
Joined: Wed Aug 30, 2017 2:37 am

Re: Fullscreen gestures with different collider ignoring nee

Postby valyard » Thu Aug 31, 2017 10:48 am

Almost correct.
This is a bit old but still relevant article on what's going on internally: https://github.com/TouchScript/TouchScr ... ouch-Point

Simplified, it is:
Code: Select all
for each layer
  raycast into scene
  find a target GameObject hit by the raycast
  give the pointer to all gestures in the hierarchy down, i.e. go -> parent -> parent -> null
  if any can recognize, fail all other waiting gestures
valyard
Site Admin
 
Posts: 434
Joined: Mon Sep 08, 2014 11:57 pm

Re: Fullscreen gestures with different collider ignoring nee

Postby TobiasW » Sat Sep 02, 2017 1:11 am

Thanks for the explanations and the link!

I also experimented a bit. It seems that the first layer hit also exits that loop, independently of whether any gestures were recognized, right?

I also only now realized that gestures recognize on parent objects even if they don't have their own collider. (Unless I prevent it with an IGestureDelegate. Man, those things are versatile and useful.)

It's slightly hard to wrap my head around all of this, but I think I'm slowly getting it. Thanks a lot for your help!
TobiasW
 
Posts: 3
Joined: Wed Aug 30, 2017 2:37 am

Re: Fullscreen gestures with different collider ignoring nee

Postby valyard » Sun Sep 03, 2017 4:03 pm

It seems that the first layer hit also exits that loop, independently of whether any gestures were recognized, right?


Correct.

I also only now realized that gestures recognize on parent objects even if they don't have their own collider.


Right, this is the main feature so to say.
valyard
Site Admin
 
Posts: 434
Joined: Mon Sep 08, 2014 11:57 pm


Return to Help and Bugs

Who is online

Users browsing this forum: No registered users and 2 guests