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);
 }
 angle=angle/Math.PI*180;
 angle=fixAngle(angle,dx,dy);
(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 to get negative number from size() in LinkedList in Java? ;-)
Abuse of Booleans ;-)
How many i 1+1 in Java? ;-)
No comments:
Post a Comment