how to find angles and relative position of certain point

Hello. can someone help me with finding relative position (from 0 to 100 or 0 to 1) of the red dot(centre of the spotlight coming from main camera)and the angles(Ox and Oy)that the vector(line maybe) of spotlight makes with the perpendicular of the plane

printscreen

inb4 thanks

There are multiple ways:

If you use a MeshCollider for your plane you can easily Raycast against it and you get the uv coordinates of the hit point which is already what you’ve asked (values between 0 and 1).

If you don’t have a MeshCollider or you don’t want to use one, you can use the Plane class and raycast against it (with the Raycast function in the plane) to determine the point on the plane. This point however is in worldspace, so you have to use InverseTransformPoint of your object to get the point in local coordinates. Transforming the local point coordinates into 0-100 or 0-1 values depends where the origin of your object is and what scale / size it has.