File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 1010
1111 < script >
1212 window . onload = ( ) => {
13+ let camera = $ ( "#world-camera" ) ;
14+
1315 let points = staticLoadPlaces ( ) ;
1416 renderPlaces ( points ) ;
1517 } ;
2123 color : 'green' ,
2224 location : {
2325 lat : 41.8377295 ,
24- lng : - 87.6562099
26+ lng : - 87.6562099 ,
27+ alt : 182
2528 }
2629 } ,
2730 // {
3740 color : 'blue' ,
3841 location : {
3942 lat : 41.8379652 ,
40- lng : - 87.6513216
43+ lng : - 87.6513216 ,
44+ alt : 182
4145 }
4246 } ,
4347 {
4448 name : 'navy pier' ,
4549 color : 'blue' ,
4650 location : {
4751 lat : 41.8412918 ,
48- lng : - 87.6242473
52+ lng : - 87.6242473 ,
53+ alt : 182
4954 }
5055 }
5156 ] ;
5560 // <a-entity material="color: red" geometry="primitive: box" gps-new-entity-place="latitude: 41.8377295; longitude: -87.6562099; position: 0 10 0" scale="10 10 10"></a-entity>
5661 function renderPlaces ( points ) {
5762 let scene = document . querySelector ( 'a-scene' ) ;
58-
63+
64+ let camAltitude = camera . getAttribute ( "position" ) . y ;
65+ alert ( camAltitude ) ;
5966 points . forEach ( ( point ) => {
6067 let model = document . createElement ( 'a-entity' ) ;
6168 model . setAttribute ( 'gps-new-entity-place' , `latitude: ${ point . location . lat } ; longitude: ${ point . location . lng } ;` ) ;
62- model . setAttribute ( 'geometry' , 'primitive: torus ' ) ;
69+ model . setAttribute ( 'geometry' , 'primitive: sphere ' ) ;
6370 model . setAttribute ( 'material' , `color: ${ point . color } ` ) ;
71+ model . setAttribute ( 'position' , `0 ${ point . location . alt - camAltitude } 0` ) ;
6472 model . setAttribute ( 'rotation' , '0 90 0' ) ;
6573 model . setAttribute ( 'scale' , '10 10 10' ) ;
6674 model . setAttribute ( 'look-at' , '[gps-new-camera]' ) ;
You can’t perform that action at this time.
0 commit comments