- Home /
Touch.Phase Differences ?
I am working in a rather complex touch system and I need some clarifitcation on the documentation provided and some related questions that follows:
Touch.canceled claims to be fired by System after some error on finger tracing like putting ur face in the screen.. But it also claims this is the final part of a touch. Touch.end claims to be itself the final part of a touch.... as well.
I am assuming there is two ways to end a touch, one is the normal behaviour under Touch.end and anotherone when some circustances are met then touch.cancel is fired...... So, when a touch is canceled, is the touch.end code executed? or viceceversa, when a touch is canceled, is the touch end executed?...
when the system triggers the touch state? at the start of the frame? could be a possible exception of switching touch.state during the same frame that could lead to execute different code blocks depending on the state of the touch?
Most code examples and mine now follows the structure of geting the array of touches and getting the touch(0) for track and play with the current touch, but when playing with multitouch.... Documentation says (fingerID is more reliable) because the array wont fit between frames.... so the question is.. is a bad practice to track gettouch(1) when touches are greater than 1? may i lose in some cases the touch tracking if playing with the array?
Could a touch dissapear from track in case of low fps peak?
thank you ! =)
Answer by NoseKills · Jun 21, 2017 at 02:24 PM
Input gathering is single threaded at least from MonoBehaviours' point of view and it happens between frames so it's not possible for the state to change between the Update() calls of 2 different objects (or during the execution of any method)
End and Cancel events end the touch and simce the state can only chenge between frames, only one of them can occurr for any given touch. E.g. it's not possible to end a single touch in a way that would cause the state to be Cancel in the ending frame and End in the one after it or vice versa.
I don't quite understand the last paragraph :)
I can't remember exactly but i think the cancel state happens fornexample if you put the app to background when a touch is ongoing, lift your finger and bring the app back to foreground.
Answer by Capoymaster · Jun 21, 2017 at 11:33 PM
OK the last paragraph is misunderstanding:::
What i mean to ask is two different things:
1st ------ Playing with multitouch ....... could a different touch share same fingerID ?? ( logic says no but documentation at this says YES "when determined by gestures", My game logic is very sensible and I am using Finger.ID for get track of the multitouch input ,if shared it could cause some touch to run functions not implemented for them ... maybe there is a way to disable gestures??
2nd -... if I undestood you said touch happens between frames and the next frame reads the state....... but again dealing with Multitouch im a bit confused because for example lets say i have 2 touch..... lets name them TOUCH A.... and TOUCH B...... my logic functions are set that wether a touch reaches "end" status ( TOUCH A or TOUCH B ) it looks on the remaining active touches....... for example if TOUCH A ended..... it changes some variables that will use the remainng touch in this case B..... and the question is....... Could I have the situation the 2 touches ended at the same time(frame)....... wich code will execute first if theyr between frames runing?
Your answer
Follow this Question
Related Questions
Merging touches 0 Answers
Rotate with two fingers 0 Answers
Use touch to spawn a prefab 1 Answer
Check whether touch is held 0 Answers
Unusual multitouch behavior (Android) 3 Answers