Hi folks,
I'm looking to draw a line from a point on a sphere to a point in
orbit, I've given it my best shot but I'm coming up a little short,
any help would be amazing.
So I have some geolocated points on a sphere, which I'm placing using
this code...
var phi:Number = (90-lat_)*Math.PI/180;
var theta:Number = (lon_ +180) * Math.PI / 180;
var xp:int = (sphereRadius) * Math.sin(phi) * Math.cos(theta);
var zp:int = (sphereRadius) * Math.sin(phi) * Math.sin(theta);
var yp:int = (sphereRadius) * Math.cos(phi);
Above each of these points I'm adding a satellite billboard
msc_= new MovieClipSprite(satellite_mc, { scaling:1, ownCanvas:true,
smooth:true, deltaZ:0, rescale:true } );
msc_.x = (sphereRadius+ 200) * Math.sin(phi) * Math.cos(theta);
msc_.z = (sphereRadius+ 200) * Math.sin(phi) * Math.sin(theta);
msc_.y = (sphereRadius+ 200) * Math.cos(phi);
I am then connecting the surface point on the sphere to it's satellite
in orbit using a linesegement...
var mat:WireframeMaterial = new WireframeMaterial( 0x56BEEC, {width:1,
height:1, thickness:2});
line_ = new LineSegment( { material:mat } );
line_.start = new Vertex(xp, yp, zp);
line_.end = new Vertex(msc_.x, msc_.y, msc_.z);
addChild(line_);
This all works perfectly, however I want to offset the position of the
satellite, something like this...
msc_.screenXOffset = 100;
But I can't figure out how to draw my line taking into account the
offset of my satellite so that they still connect, if awayone has an
idea how I could do this I'd really appreciate your help.