3

I'm working on a SceneKit project in Objective-C, trying to rotate a sphere (representing a planet) so that a point at a given longitude/latitude coordinate is facing "forward" (i.e. that point moves to the {0,0} position). So for example, we're looking at Earth's {0,0} point, off the coast of Africa, but I need to know what rotation vector would have us looking at {37,-122}, aka San Francisco. Ideally, the planet would remain "naturally" oriented, with north remaining generally "up" from our perspective, but that's flexible.

I've got the animation working and I can rotate to a given longitude OR latitude using SCNVector4, but as soon as I try to rotate to a given longitude AND latitude, it gets wildly messed up. So I've been doing some research, and I've found some resources that seem to do exactly what I need, but to be honest they're a bit beyond me. I'm a complete newbie in the world of trigonometry and matrices, and it seems there's no way around this problem without them.

Can anyone help me understand how these concepts can take Lat/Long coordinates, and calculate a SCNVector4? A method for creating a SCNVector4 based on the desired Lat/Long would be perfect, but even just help with calculating the components individually would be greatly appreciated!

Community
  • 1
  • 1
Nerrolken
  • 1,884
  • 3
  • 22
  • 49

0 Answers0