JSFiddle - React, Tailwind, and code Playground
by dash1
HTML
<head>
<title>A-Frame</title>
<meta name="description" content="A-Frame">
<script src="https://aframe.io/releases/0.9.2/aframe.min.js"></script>
<script type="text/javascript" src="ascript.js"></script>
<script src="//cdn.rawgit.com/donmccurdy/aframe-extras/v4.1.1/dist/aframe-extras.min.js"></script>
<script src="https://unpkg.com/aframe-fps-counter-component/dist/aframe-fps-counter-component.min.js"></script>
</head>
<body>
<a-scene city>
<a-plane id="plane" geometry="primitive: plane" scale="10000 10000 0" position="0 0 -0.003" rotation="0 0 0" color="#8a6642"> </a-plane>
<a-entity id="camrig" wasd-controls="acceleration: 1" >
<a-entity camera id="cam" look-controls position="0 0 0"></a-entity>
</a-entity>
<a-box xaxis position="0 0 0" scale="15000 5 5" color="#ff0000"></a-box>
<a-box yaxis position="0 0 0" scale="5 15000 5" color="#00ff00"></a-box>
<a-box zaxis position="0 0 0" scale="5 5 15000" color="#0000ff"></a-box>
<a-sky color="#6EBAA7"></a-sky>
</a-scene>
</body>
JavaScript
let floorPointsx = [];
let floorPointsy = [];
let floorPointsz = [];
let roofPointsx = [];
let roofPointsy = [];
let roofPointsz = [];
let floorxyzpoints = [];
let roofxyzpoints = [];
let singleLineGeometry = new THREE.Geometry();
/**
* This function creates Building objects and attaches them to the scene.
* @param {a-entity} component - The component to attach the created elements to.
*/
function createBuildings(component) {
floorPointsx[0] = 1901.9898964735107;
floorPointsy[0] = 4160.2689216
floorPointsz[0] = 0.0003;
floorPointsx[1] = 1901.990296810338;
floorPointsy[1] = 4160.2738254000005;
floorPointsz[1] = 0.0003;
floorPointsx[2] = 1901.9978514250315;
floorPointsy[2] = 4160.2732072;
floorPointsz[2] = 0.0003;
floorPointsx[3] = 1901.9974510899494;
floorPointsy[3] = 4160.2683232;
floorPointsz[3] = 0.0003;
floorPointsx[4] = 1901.9898964735107;
floorPointsy[4] = 4160.2689216
floorPointsz[4] = 0.0003;
roofPointsx[0] = 1901.9898964735107;
roofPointsy[0] = 4160.2689216
roofPointsz[0] = 0.0009;
roofPointsx[1] = 1901.990296810338;
roofPointsy[1] = 4160.2738254000005;
roofPointsz[1] = 0.0009;
roofPointsx[2] = 1901.9978514250315;
roofPointsy[2] = 4160.2732072;
roofPointsz[2] = 0.0009;
roofPointsx[3] = 1901.9974510899494;
roofPointsy[3] = 4160.2683232;
roofPointsz[3] = 0.0009;
roofPointsx[4] = 1901.9898964735107;
roofPointsy[4] = 4160.2689216
roofPointsz[4] = 0.0009;
for (var i = 0; i < floorPointsx.length; i++) {
floorxyzpoints.push(new THREE.Vector3(floorPointsx[i], floorPointsy[i], 0));
roofxyzpoints.push(new THREE.Vector3(roofPointsx[i], roofPointsy[i], roofPointsz[i]));
}
for (var i = 0; i < roofxyzpoints.length - 1; i++) {
singleLineGeometry.vertices.push(roofxyzpoints[i]);
singleLineGeometry.vertices.push(roofxyzpoints[i + 1]);
singleLineGeometry.vertices.push(roofxyzpoints[i]);
singleLineGeometry.vertices.push(floorxyzpoints[i]);
...