Hello,
I’m currently attempting to have a split screen input scheme where each half of the screen can detect and output different input. When independently testing them (as in only swiping on the right or on the left) they work and out put independently. The problem I’m currently having is that when attempting to use them at the same time (such as swiping up on the left side and down on the right) they won’t register this and either only have one side complete the action, or have both sides detect the swipe as a tap. I have attempted to use fingerID which helped a little, as it prevented odd bugs, such a swipe starting on the left side and ending on the right side being detected as a right side swipe, but aside form that multitouch doesn’t seem to be working.
Here is the code where the screen is split:
void Start()
{
Input.multiTouchEnabled = true;
}
void Update()
{
if (Input.touchCount > 0)
{
foreach (Touch touch in Input.touches)
{
if (touch.position.x < Screen.width / 2)
{
LeftControl ();
}
else
{
RightControl ();
}
}
}
}
And here is how finger Id id being used:
if (t.phase == TouchPhase.Began) {
firstPressPos = new Vector2 (t.position.x, t.position.y);
position.Add (new Vector2 (firstPressPos.x, secondPressPos.y));
finIdL = t.fingerId;
}
if (t.phase == TouchPhase.Moved) {
position.Add (new Vector2 (t.position.x, t.position.y));
}
if (t.phase == TouchPhase.Ended) {
if (t.fingerId == finIdL) {
secondPressPos = new Vector2 (t.position.x, t.position.y);
position.Add (new Vector2 (secondPressPos.x, secondPressPos.y));
currentSwipe = new Vector3 (secondPressPos.x - firstPressPos.x, secondPressPos.y - firstPressPos.y);
StarttoMid = new Vector3 (position [z/ 2].x - firstPressPos.x, position [z / 2].y - firstPressPos.y);
MidtoEnd = new Vector3 (secondPressPos.x - position [z / 2].x, secondPressPos.y - position [z / 2].y);
Total = StarttoMid.magnitude + MidtoEnd.magnitude;
finIdL = -1;
CoordinateX.LX = currentSwipe.magnitude;
CoordinateY.LY = Total;
compare = currentSwipe.magnitude;
position.Clear();
}
Any help would be greatly appreciated.