I am trying to create a series of waypoints for my globe planet, in a little simulation I'm doing, and I'm trying to use polar to cartesian coordinates, I learnt this formula off its wikipedia page. Though I still don't quite understand it.
https://en.wikipedia.org/wiki/Spherical_coordinate_system
Attempt 1; This is the image of my first attempt, I do not want to cluster the points near the poles, the poles are also at the completely wrong point, I will supply my code later on. But also I do not want to put points too close to the poles, as they are not in use, and due to camera gimbal locking, there is no point me going too far close to the north or south pole in my program.
Attempt 2: Now I know how to create a single line, and the code I use for this is provided below. I sort of figured this out by just testing out different values and seeing how it came about.
Now what I want to do to this, I think as the way I wish to construct it, is to get the vector of each of those points, and rotate them round the centre of the planet which in this example is (0,0,0) I want to create a single line of longitude per pas, so I can number the points 0-50 on each line, that will allow me to use it as a connected grid,lets say 0-50 going upwards, so that if i start at point 1 which would be the first point near the south pole, and I want to go to the next row I would add 50 to get to 51 (which would be the point right of it) or take 50 to get the point left of it), and so on and so forth, this will allow me to easily join waypoints for pathfinding setup.
I made another attempt in the link [ABOVE], where I try and make a nested for loop and change the latitude per step, but it does not get the desired result, I have even swapped the values of lat and longitude around in the code and the coordinates are the same.
Latitude = should be the angle from east to west. Longitude = should be the angle north to south.
To do this I think but I am not sure, I assume I will have to store a temporary value of each of those points, and then create a new vector from them, by rotating their vectors around the origin of the planet (0,0,0) and then creating a new set of these points at the temporary vectors.
Does anybody have an idea how to help me solve my problem, as Image 4 is the best explanation I can think of showing my problem to explain what I am trying to achieve.