File size: 1,092 Bytes
c57b743
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ae1303b
c57b743
 
 
 
 
 
 
 
 
 
ae1303b
c57b743
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>A-Frame 3D Map Flight</title>
    <script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
  </head>
  <body>
    <a-scene>
      <!-- Load the map surface as a dataset -->
      <a-plane id="map-surface"
               height="50"
               width="50"
               position="0 0 -50"
               material="shader:flat;color:#333;src:#map-data"></a-plane>

      <!-- Define the map data as a text asset -->
      <a-assets>
        <a-asset-item id="map-data" src="#map-data-text"></a-asset-item>
        <a-text id="map-data-text" value='[
          {"x": -10, "y": 0, "z": -10},
          {"x": 10, "y": 0, "z": -10},
          {"x": 10, "y": 0, "z": 10},
          {"x": -10, "y": 0, "z": 10}
        ]'></a-text>
      </a-assets>

      <!-- Set the camera to the player's viewpoint and add a flying script -->
      <a-entity id="camera"
                position="0 1.6 0"
                camera
                wasd-controls
                fly></a-entity>
    </a-scene>
  </body>
</html>