- Home /
How do you get position from fingerId
I want to have two objects on the screen that you can rotate by dragging your finger. Just by using input.GetTouch(i) when dragging with both fingers the rotations get stuttery but just using one finger the rotation is fine. I have been told I need to use fingerId to get this to work properly but have no idea how to associate fingerId positions with objects. Here is my code below:
public float rotSpeed;
public Transform leftCube;
public Transform rightCube;
void Update()
{
if(Input.touchCount > 0)
{
for(int i = 0; i < Input.touchCount; i++)
{
if(Input.GetTouch(i).position.x < Screen.width/2)
{
leftCube.Rotate(Vector3.up, -Input.GetTouch(i).deltaPosition.x * rotSpeed, Space.World);
}
else
{
rightCube.Rotate(Vector3.up, -Input.GetTouch(i).deltaPosition.x * rotSpeed, Space.World);
}
}
}
}
Answer by OverGast · Nov 15, 2020 at 10:19 AM
Hi! Maybe you already got your answer, but in case you or anyone who arrives to this page still need it, check the answer in the following article, it solves the issue: https://answers.unity.com/questions/362591/multitouch-second-touch-interferes-with-the-first.html
Your answer
Follow this Question
Related Questions
How to implement android touch input joysticks for the lego microgame 2 Answers
How to enable multiple button presses on a touchscreen virtual button control scheme 1 Answer
If I use Both input systems during development, will the final product work fine? 0 Answers
¿Unity messing up fingerIDs? [Android] 1 Answer
How to detect whether a particular touch has ended? 1 Answer