Latitude / Longitude to Vector3D angles (for sphere globe rotation)

Software: Away3D 4.x

Josh S., Newbie
Posted: 21 March 2013 09:23 PM   Total Posts: 2

I have a typical globe / sphere set up using a texture map with a 2:1 aspect ratio.

Looks like a globe of the earth. Great.

I need to be able to ROTATE this globe object to a known latitude / longitude.

private void function latLonToRotation(lat:Numberlon:Number):Vector3D {
   
private var v3d:Vector3D;

   
// calculate X,Y,Z rotation values for a globe sphere

   
return v3d;

Plenty of examples out there on how to place 3D objects on the surface of a 3D sphere, or get 2D coordinates based on mouse click upon the 3D object, but that’s not what I need.

I simply want to feed this function the latitude & longitude of, say, New York City, get back a Vector3D that has the correct rotation angles for X, Y,  and Z. Then I can do globe.rotateTo(v3d) and New York City will be facing “toward me” (a camera positioned at 0,0,-1000, set to lookAt 0,0,0—- camera always looks toward the center of the globe)

I also need the globe to not appear to be tilted to the left or right. To the viewer, it should always appear that the globe is “straight up and down”.

It seems like this should be simple and I bet it’s been done thousands of times, but I’m getting nowhere. Due in no small part not knowing what terminology to search for.

Can anyone here help me with this?

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X