Sunday, June 29, 2008

How we may use Google Earth Plugin? :-)

Some time ago Google introduces Google Earth Plugin.

Playing with this plug-in I tried to use GPS track from my visit in LA to create some kind virtual trip :-)

See in new window

Nice? :-) [you must remember that to see it you will need Google Earth Plugin and rather quick connection to the Internet]

Most important thing in this solution is using of GPS data not only to place us "in the World" but also to determine camera angle.
I decided to use vector created from current point and next point of GPS track [OK, truly it's not full GPS track but only some points], when I know this vector I may calculate camera angle.

function fixAngle(angle,dx,dy) {
if (dx==0) {
if (dy>=0) angle = 90;
else angle = 270;
} else if ((dx>0) && (dy>=0)) {
angle = angle;
} else if ((dx>0) && (dy<0)) {
angle = angle+=360;
} else if ((dx<0)) {
angle = angle + 180;
return angle%360;
var dx = nx-x;
var dy = ny-y;
var angle = 0;
if (dx!=0) {
angle = Math.atan(dy/dx);
Where (nx,ny) are coordinates of next point in track and (x,y) are coordinates of current point.

Btw. imagine, using this plug-in and some server we may build real-time and super realistic multiplayer flight simulator :-)

Similar postsbeta
Recursion is evil ;-)
How to create valid file name?
How many i 1+1 in Java? ;-)
Abuse of Booleans ;-)
Google Buzz - let's mark some comments as not spam ;-) or how to unhide "hidden" comments ;-)

No comments:

Post a Comment