/
meshcat.html
49 lines (43 loc) · 1.25 KB
/
meshcat.html
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
<!DOCTYPE html>
<!-- This file is forked from dist/index.html in rdeits/meshcat. -->
<html>
<head>
<meta charset=utf-8>
<title>Drake MeshCat</title>
</head>
<body>
<div id="meshcat-pane">
</div>
<script type="text/javascript" src="meshcat.js"></script>
<script>
var viewer = new MeshCat.Viewer(document.getElementById("meshcat-pane"));
// Set background to match Drake Visualizer.
viewer.set_property(['Background'], "top_color", [.95, .95, 1.0])
viewer.set_property(['Background'], "bottom_color", [.32, .32, .35])
// Set the initial view looking up the y-axis.
viewer.set_property(['Cameras', 'default', 'rotated', '<object>'],
"position", [0.0, 1.0, 3.0])
try {
url = location.toString();
url = url.replace("http://", "ws://")
url = url.replace("https://", "wss://")
url = url.replace("/index.html", "/")
url = url.replace("/meshcat.html", "/")
viewer.connect(url);
} catch (e) {
console.info("Not connected to MeshCat websocket server: ", e);
}
</script>
<style>
body {
margin: 0;
}
#meshcat-pane {
width: 100vw;
height: 100vh;
overflow: hidden;
}
</style>
<script id="embedded-json"></script>
</body>
</html>