Geographic to cartesian coordinates on the surface of a sphere

I’m trying to make a globe scene where the player can fire missiles from one location to another. My current issue is getting a red marker to appear at the correct location on the sphere when given a latitude and longitude.

I found some math for the conversion of geographic to cartesian coordinates (see below) and it sort of works, but the position is off. If you look in the attached picture, the geographic coordinates given are 0,90 which should be the north pole. but unless the north pole is now in northern Canada, the result is a bit off.

So where is my math wrong? or did I miss something else?

public static void SphericalToCartesian(float radius, float polar, float elevation, out Vector3 outCart){
   float a = radius * Mathf.Cos(elevation);
   outCart.x = a * Mathf.Cos(polar);
   outCart.y = radius * Mathf.Sin(elevation);
   outCart.z = a * Mathf.Sin(polar);
}

32643-earth.png

Hi, if you want to use degrees instead of radiants: use “Mathf.Deg2Rad * value” for your computations with “elevation” and “polar”! ( Mathf.Cos(Mathf.Deg2Rad * elevation) etc…)