Basketball shot distance

I’m making a basketball game, and I want to be able to check if a player shoots a 3 pointer or a 2 pointer. The NBA 3 point line is not a perfect half circle so it is a different distance in the corners from the hoop. How could I check if a player shoots a 3 pointer?

It may not be the most efficient way of doing it. But what I would do is cast two rays, one towards the hoop, the other towards the endline, and triangulate where the player is in reference to the court. Then check the values of where the player is, with some set values of where they should be for it to be a three. And to get the ray to fire in the correct direction, for the ray going to the endline, just check with half the player is on first, then use that to set the ray direction.

From Basketball court - Wikipedia

The NBA three-point line is 3 ft (0.91 m) from the sideline in a zone starting at the baseline and ending when it crosses the 23.75 ft (7.24 m) arc. The 22 ft (6.70 m) distance exists only at the points on the three-point line that are directly to the left and right of the basket center.

So just check if they’re at least 23.75 ft from the hoop or 22 ft away on the axis aligned with the backboard. If either are true, they’re outside the 3-point line.

Wow I did not think of that! I could probably use Dot for that. Thank you!

I will test both of your solutions. I very much appreciate the help!