First post here, I’m probably aware that i might cross some rules…
I’m trying to wrap my head around the trigonometry involved to compute the 3D coordinates on a sphere from a 2D (x/y) point. I understand that trigonometry is a subject given on schools in the US, but i’m afraid that my school didn’t touch the subject at all. I got myself a Brilliant subscription and so far so good (not fully used to the english trigonometry terms though!)
So, to get the corresponding coordinates in need to calculate the following (if I’m correct):
Theta: tan ( y-coordinate / x-coordinate )
Phi: sin ( y-coordinate / radiant)
x = radiant * cos(theta) * sin(Phi)
y = radiant * sin(theta) * sin(phi)
z = radiant * cos(phi)
so then in the expression menu I put the following:
x = transform.position[0];
y = transform.position[1];
r = 250
phi = Math.sin(y,r);
theta = Math.atan2(y,x);
[r*Math.cos(theta)*Math.sin(phi), r*Math.sin(theta)*Math.sin(phi), r*Math.cos(phi)]
For some reason the coordinates sometimes match, and sometimes completely shift positions.
I think I might’ve gotten to cocky after getting a few good answers on the brilliant puzzels …
If somebody could point me in the right direction, I would be very thankful!
Kind regards,