Added logic for moving objects
parent
3d3838943b
commit
7a40e7a6d1
|
@ -52,11 +52,10 @@ function updateStreetView(loc){
|
||||||
|
|
||||||
// Set panorama
|
// Set panorama
|
||||||
getStreetViewData(loc, 2, function(data){
|
getStreetViewData(loc, 2, function(data){
|
||||||
pano.setPano(data.location.pano);
|
pano.setPano(data.location.pano);
|
||||||
pano.setPov({
|
pano.setPov({
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
// Point towards users's location from street
|
heading: (loc.spd>1)?loc.dir:Math.atan((loc.lon-data.location.latLng.lng())/(loc.lat-data.location.latLng.lat()))*(180/Math.PI)
|
||||||
heading: Math.atan((loc.lon-data.location.latLng.lng())/(loc.lat-data.location.latLng.lat()))*(180/Math.PI)
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -73,6 +72,8 @@ else { navigator.geolocation.watchPosition(
|
||||||
newLoc = {
|
newLoc = {
|
||||||
lat: pos.coords.latitude,
|
lat: pos.coords.latitude,
|
||||||
lon: pos.coords.longitude,
|
lon: pos.coords.longitude,
|
||||||
|
spd: pos.coords.speed,
|
||||||
|
dir: pos.coords.heading,
|
||||||
tim: new Date()
|
tim: new Date()
|
||||||
};
|
};
|
||||||
updateStreetView(newLoc,10);
|
updateStreetView(newLoc,10);
|
||||||
|
|
Loading…
Reference in New Issue