# Calculating distance from center of a circle(e.g. archery board)

Suppose i have a 2d archery game(silly, i know). Player’s job is to tap the moving circular archery board. Depending of the accuracy of the tap the player will get a score. More the center is the tap, the more is the score.
So, after determining if the tap is within the circle I have to calculate the tap accuracy(by accuracy i mean how close is the tap from the center of the circle)

So, how to calculate the distance from the center of the circle to a specific point?

.

Vector2.Distance(center, le_random_point);
or
Vector3.Distance(center, le_random_point);

tnx, i know that part. but how can i know my tap is in the circle or not?

But that was your question, how to calculate the distance Clearly if the distance is greater than the radius of your circle the tap is outside, if less it is inside.

1 Like

You could do something such as worldPosition = camera.ScreenToWorldPoint(tapPosition) where tapPosition’s z component is equal to the target’s z component. Then you could get the distance between the target’s center and the tap point using Vector3.Distance(tapPosition, targetPosition).