Drawing the line short was causing a few problems when it came to placement and perspective, but I managed to get something working using screenZOffset.
Thanks for the help Fabrice it's much appreciated. On Jun 1, 1:23 pm, Fabrice3D <[email protected]> wrote: > multiplying the position by the normalised vector as Michael suggested seams > to me the best way to go. > if they are that appart from each other in your demo, the segment end just > needs be shorter to avoid sorting issues or place the mc farther > away, which results in same visual display. > > another option would be to target slightly beneath position of the satellite, > but that would of course in a certain way the way the lines > are displayed. That last one would prevent updates of 2 points if you would > for some reason need on user interaction to move the satellite. > > Fabrice > > On Jun 1, 2010, at 2:01 PM, Josh wrote: > > > Wow thanks for the quick reply guys, > > > I've just rethought what I'm doing and rather than using screenXOffset > > to offset the satellite I'm just adding a few extra degress to my > > longitude wchi does the trick. > > > However I now have the problem that as the billboard satellite orbits > > my sphere the line I'm drawing to them appears sometimes appears on > > top of the satellite, especially when the satellites are to the left > > or right of the sphere. > > > I've thrown a demo and screen grab up so you can see what I mean. > > >http://visualdialects.co.uk/orbitDemo/orbitGrab.jpg > >http://visualdialects.co.uk/orbitDemo/index.html > > > thanks guys. > > > On Jun 1, 12:35 pm, Fabrice3D <[email protected]> wrote: > >> You have different align strings props, and if that doesn't help, what > >> if the mc is a container and you would simply alter the x of a child > >> of his? > > >> Sent from an iPhone without Flash > > >> On Jun 1, 2010, at 13:23, Josh <[email protected]> wrote: > > >>> 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.
