marker orientation on earth

Software: Away3D 4.x

mindthegap, Newbie
Posted: 22 July 2016 03:54 PM   Total Posts: 6

hi,

I want to put a few markers on an earth. I am using google locations to postion the markers.

when putting the markers flat on the earth everthing is fine. now I tried to put the markers parallel to the screen.
thats ok with lookat to the markers.y point. but a flag in newsealand hangs with the head in the earth, in alaska the marker sinks into the earth.

how can I correct this?

d.


var phi:Number = (90 - (jsonObject.geo).coordX -3.0) * Math.PI / 180;
var theta:Number = ( (jsonObject.geo).coordY + 180) * Math.PI / 180;
 
var flagMaterial:TextureMaterial = new TextureMaterial( Cast.bitmapTexture( this[“flag_” + (jsonObject.geo).short] ) );
flagMaterial.alphaBlending = true;
    //
   
var marker = new Mesh(new PlaneGeometry(12, 12) ,flagMaterial);
marker.x = (earthRadius + 0) * Math.sin(phi) * Math.cos(theta);
marker.z = (earthRadius + 2.7) * Math.sin(phi) * Math.sin(theta);
marker.y = (earthRadius + 2.7) * Math.cos(phi);

// marker shood stand parallel to the screen
marker.lookAt(new Vector3D(0, marker.y, 0));

// ?????? how to rotate markers and remove different distances
   
   
/*markers flat on earth
marker.lookAt(new Vector3D(0, 0, 0));
marker.pitch(-90);*/

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X