Hello fellow unity users ![]()
I have a small problem with the new 2d raycastHit
My code
void Update()
{
var i = 0;
while (i < Input.touchCount)
{
if (Input.GetTouch(i).phase == TouchPhase.Began)
{
RaycastHit2D hit = Physics2D.Raycast(transform.position, Input.GetTouch(i).position, 1000);
if (hit != null)
{
Destroy(hit.transform.gameObject);
}
}
++i;
}
}
It seems the position on the phone where i hit is random.
Can anybody help me with this ??
Best regards
Wacky Moose