File size: 7,187 Bytes
28c86c4
 
57ac313
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28c86c4
57ac313
28c86c4
57ac313
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28c86c4
57ac313
 
 
 
 
 
 
28c86c4
57ac313
 
 
 
 
 
 
 
 
 
28c86c4
 
57ac313
 
28c86c4
57ac313
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28c86c4
57ac313
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a9f5abc
 
 
 
 
 
 
 
57ac313
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4b79a60
57ac313
 
 
 
 
 
 
 
 
4b79a60
57ac313
 
 
 
4b79a60
 
 
464231f
 
4b79a60
 
 
33dd122
 
 
 
 
4b79a60
57ac313
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!DOCTYPE html>
<html lang="en-us">

<head>
  <meta charset="utf-8">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
  <title>excav_simul_3d</title>
  <link rel="shortcut icon" href="TemplateData/favicon.ico">
  <link rel="stylesheet" href="TemplateData/style.css">
  <link rel="stylesheet" href="main.css">
</head>

<body class="dark">
  <div id="unity-container" class="unity-desktop">
    <canvas id="unity-canvas"></canvas>
  </div>
  <div id="loading-cover" style="display:none;">
    <div id="unity-loading-bar">
      <div id="unity-logo"><img src="logo.png"></div>
      <div id="unity-progress-bar-empty" style="display: none;">
        <div id="unity-progress-bar-full"></div>
      </div>
      <div class="spinner"></div>
    </div>
  </div>
  <div id="unity-fullscreen-button" style="display: none;"></div>
  <script>

    const hideFullScreenButton = "";

    const buildUrl = "Build";

    const loaderUrl = buildUrl + "/SimplifiedTerrain-simpleMovement-demo-webgl-dev.loader.js";

    const config = {

      dataUrl: buildUrl + "/SimplifiedTerrain-simpleMovement-demo-webgl-dev.data",

      frameworkUrl: buildUrl + "/SimplifiedTerrain-simpleMovement-demo-webgl-dev.framework.js",

      codeUrl: buildUrl + "/SimplifiedTerrain-simpleMovement-demo-webgl-dev.wasm",

      streamingAssetsUrl: "StreamingAssets",

      companyName: "DefaultCompany",

      productName: "excav_simul_3d",

      productVersion: "0.1",

    };



    const container = document.querySelector("#unity-container");

    const canvas = document.querySelector("#unity-canvas");

    const loadingCover = document.querySelector("#loading-cover");

    const progressBarEmpty = document.querySelector("#unity-progress-bar-empty");

    const progressBarFull = document.querySelector("#unity-progress-bar-full");

    const fullscreenButton = document.querySelector("#unity-fullscreen-button");

    const spinner = document.querySelector('.spinner');



    const canFullscreen = (function () {

      for (const key of [

        'exitFullscreen',

        'webkitExitFullscreen',

        'webkitCancelFullScreen',

        'mozCancelFullScreen',

        'msExitFullscreen',

      ]) {

        if (key in document) {

          return true;

        }

      }

      return false;

    }());



    if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {

      container.className = "unity-mobile";

      config.devicePixelRatio = 1;

    }

    loadingCover.style.display = "";



    const script = document.createElement("script");

    script.src = loaderUrl;

    script.onload = () => {

      createUnityInstance(canvas, config, (progress) => {

        spinner.style.display = "none";

        progressBarEmpty.style.display = "";

        progressBarFull.style.width = `${100 * progress}%`;

      }).then((unityInstance) => {

        loadingCover.style.display = "none";

        if (canFullscreen) {

          if (!hideFullScreenButton) {

            fullscreenButton.style.display = "";

          }

          fullscreenButton.onclick = () => {

            unityInstance.SetFullscreen(1);

          };

        }

      }).catch((message) => {

        alert(message);

      });

    };

    document.body.appendChild(script);

  </script>
  <div id="infoBox">
    <h1>Controls</h1>
    <div id="controls">
      <table>
        <th>Binding</th>
        <th>Description</th>
        <tr>
          <td>Right Mouse Click (Drag)</td>
          <td>
            Rotates the camera in the direction of the mouse drag.
          </td>
        </tr>
        <tr>
          <td>Left Mouse Click</td>
          <td>
            Sets the goal point to the location on the terrain where you clicked.
          </td>
        </tr>
        <tr>
          <td>W</td>
          <td>
            Move forward.
          </td>
        </tr>
        <tr>
          <td>S</td>
          <td>
            Move backward.
          </td>
        </tr>
        <tr>
          <td>A</td>
          <td>
            Move left.
          </td>
        </tr>
        <tr>
          <td>D</td>
          <td>
            Move right.
          </td>
        </tr>
        <tr>
          <td>E</td>
          <td>Move up.</td>
        </tr>
        <tr>
          <td>Q</td>
          <td>Move down.</td>
        </tr>
        <tr>
          <td>R</td>
          <td>
            Restart the episode.
            Note that the terrain does not change even if you are in random mode.
            Deformations to the terrain are preserved as well.
          </td>
        </tr>
        <tr>
          <td>1</td>
          <td>
            <div class="cellHeader">Terrain Mode: RANDOM</div>
            Restart with a random terrain shape (no perlin noise).
          </td>
        </tr>
        <tr>
          <td>2</td>
          <td>
            <div class="cellHeader">Terrain Mode: RANDOM_NOISE</div>
            Restart with a random terrain shape (with perlin noise).
          </td>
        </tr>
        <tr>
          <td>3</td>
          <td>
            <div class="cellHeader">Terrain Mode: GAUSSIAN_SLOPE</div>
            Restart with a gaussian slope shaped terrain.
          </td>
        </tr>
        <tr>
          <td>4</td>
          <td>
            <div class="cellHeader">Terrain Mode: POINTY_GAUSSIAN_SLOPE</div>
            Restart with a <i>pointy</i> gaussian slope shaped terrain.
          </td>
        </tr>
        <tr>
          <td>5</td>
          <td>
            <div class="cellHeader">Terrain Mode: TRAPEZOIDAL_HILL</div>
            Restart with a trapezoidal hill shaped terrain.
          </td>
        </tr>
      </table>
    </div>
    <h1>Disclaimer</h1>
    <div id="disclaimerBody">
      <p>
        <a target=”_blank” href="https://docs.unity3d.com/Packages/[email protected]/manual/index.html#inference">
          Unfortunately, MLAgents doesn't support GPU inference for WebGL builds.
        </a><br>
        The current model is small enough that it runs smoothly with GPU
        inference, but large enough that it runs slowly with CPU inference.
        If you would like to receive the latest build on your target platform,
        PM cm107 on huggingface.
      </p>
      <p>
        For more information about WebGL performance considerations, refer to
        <a target=”_blank” href="https://docs.unity3d.com/Manual/webgl-performance.html">
          the unity documentation
        </a>.
      </p>
    </div>
    <h1>Downloads</h1>
    <ul>
      <li>
        <a download="linux-build.zip"

          href="https://huggingface.co/spaces/cm107/excav_demo/resolve/main/linux-build.zip">
          Linux Build
        </a>
      </li>
      <li>
        <a download="mac-build.zip" href="https://huggingface.co/spaces/cm107/excav_demo/resolve/main/mac-build.zip">
          Mac Build
        </a>
      </li>
    </ul>
  </div>
</body>

</html>