Question by
Axilex62 · Nov 14, 2021 at 12:51 PM ·
unity 2dmouseclick
Enlarge touched area of mouse on GameObject - Unity
Hello,
When i test on Unity with my mouse i can catch balls but when i'm on my phone i can't.
I use onmousedown for that but on my phone the balls are too fast and so I can't catch them properly.
My ball is a gameobject with circle collider, rigidbody and a graphic into it to render the ball.
That's my OnMouseDown() fonction
private void OnMouseDown() {
screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, input.mousePosition.y, screenPoint.z));
captured = true;
}
My question is how i can enlarge the touch area ?
Thank you in advance for your help !
Comment
Your answer
