!function t(e,i,n){function s(r,a){if(!i[r]){if(!e[r]){var l="function"==typeof require&&require;if(!a&&l)return l(r,!0);if(o)return o(r,!0);var h=new Error("Cannot find module '"+r+"'");throw h.code="MODULE_NOT_FOUND",h}var c=i[r]={exports:{}};e[r][0].call(c.exports,function(t){var i=e[r][1][t];return s(i||t)},c,c.exports,t,e,i,n)}return i[r].exports}for(var o="function"==typeof require&&require,r=0;r0&&this.el.emit("jumpend"),this.numJumps=0}})},{}],7:[function(t,e,i){"use strict";e.exports=AFRAME.registerComponent("kinematic-body",{dependencies:["velocity"],schema:{mass:{default:5},radius:{default:1.3},linearDamping:{default:.05},enableSlopes:{default:!0},enableJumps:{default:!1}},init:function(){this.system=this.el.sceneEl.systems.physics,this.system.addComponent(this);var t=this.el,e=this.data,i=(new CANNON.Vec3).copy(t.object3D.getWorldPosition(new THREE.Vector3));this.body=new CANNON.Body({material:this.system.getMaterial("staticMaterial"),position:i,mass:e.mass,linearDamping:e.linearDamping,fixedRotation:!0}),this.body.addShape(new CANNON.Sphere(e.radius),new CANNON.Vec3(0,e.radius,0)),this.body.el=this.el,this.el.body=this.body,this.system.addBody(this.body),t.hasAttribute("wasd-controls")&&console.warn("[kinematic-body] Not compatible with wasd-controls, use movement-controls.")},remove:function(){this.system.removeBody(this.body),this.system.removeComponent(this),delete this.el.body},beforeStep:function(t,e){if(e){var i=this.el,n=this.data,s=this.body;n.enableJumps||s.velocity.set(0,0,0),s.position.copy(i.getAttribute("position"))}},step:function(){var t=new THREE.Vector3,e=new THREE.Vector3,i=new THREE.Vector3,n=new THREE.Vector3;return function(s,o){if(o){var r=this.body,a=this.data,l=void 0,h=-1/0,c=void 0,d=this.system.getContacts();o=Math.min(o,1e3*this.system.data.maxInterval),n.set(0,0,0),t.copy(this.el.getAttribute("velocity")),r.velocity.copy(t);for(var u,p=0;u=d[p];p++)if(u.enabled){if(r.id===u.bi.id)u.ni.negate(i);else{if(r.id!==u.bj.id)continue;i.copy(u.ni)}r.velocity.dot(i)<-1e-6&&i.y<=.5?t.projectOnPlane(i):i.y>.5&&(l=r.id===u.bi.id?Math.abs(u.rj.y+u.bj.position.y):Math.abs(u.ri.y+u.bi.position.y))>h&&(h=l,n.copy(i),c=r.id===u.bi.id?u.bj:u.bi)}e.copy(t).normalize(),c&&(!a.enableJumps||e.y<.5)?(a.enableSlopes?n.y<1-1e-6&&n.copy(this.raycastToGround(c,n)):n.set(0,1,0),t.projectOnPlane(n)):this.system.driver.world&&t.add(this.system.driver.world.gravity.scale(4*o/1e3)),r.velocity.copy(t),this.el.setAttribute("velocity",r.velocity),this.el.setAttribute("position",r.position)}}}(),raycastToGround:function(t,e){var i=void 0,n=void 0,s=this.body.position,o=this.body.position.clone();return(i=new CANNON.Ray(s,o))._updateDirection(),i.intersectBody(t),i.hasHit?(n=i.result.hitNormalWorld,Math.abs(n.y)>Math.abs(e.y)?n:e):e}})},{}],8:[function(t,e,i){"use strict";e.exports=AFRAME.registerComponent("mesh-smooth",{init:function(){this.el.addEventListener("model-loaded",function(t){t.detail.model.traverse(function(t){t.isMesh&&t.geometry.computeVertexNormals()})})}})},{}],9:[function(t,e,i){"use strict";e.exports=AFRAME.registerComponent("normal-material",{init:function(){this.material=new THREE.MeshNormalMaterial({flatShading:!0}),this.applyMaterial=this.applyMaterial.bind(this),this.el.addEventListener("object3dset",this.applyMaterial)},remove:function(){this.el.removeEventListener("object3dset",this.applyMaterial)},applyMaterial:function(){var t=this;this.el.object3D.traverse(function(e){e.isMesh&&(e.material=t.material)})}})},{}],10:[function(t,e,i){"use strict";e.exports=AFRAME.registerComponent("sphere-collider",{schema:{objects:{default:""},state:{default:"collided"},radius:{default:.05},watch:{default:!0}},init:function(){this.observer=null,this.els=[],this.collisions=[],this.handleHit=this.handleHit.bind(this),this.handleHitEnd=this.handleHitEnd.bind(this)},remove:function(){this.pause()},play:function(){var t=this.el.sceneEl;this.data.watch&&(this.observer=new MutationObserver(this.update.bind(this,null)),this.observer.observe(t,{childList:!0,subtree:!0}))},pause:function(){this.observer&&(this.observer.disconnect(),this.observer=null)},update:function(){var t=this.data,e=void 0;e=t.objects?this.el.sceneEl.querySelectorAll(t.objects):this.el.sceneEl.children,this.els=Array.prototype.slice.call(e)},tick:function(){var t=new THREE.Vector3,e=new THREE.Vector3,i=new THREE.Vector3,n=new THREE.Vector3,s=new THREE.Box3,o=new Map;return function(){var r=this.el,a=this.data,l=[],h=void 0;r.getObject3D("mesh")&&(o.clear(),r.object3D.getWorldPosition(t),r.object3D.getWorldScale(i),h=a.radius*function(t){return Math.max.apply(null,t.toArray())}(i),this.els.forEach(function(i){var r=void 0,a=void 0,c=void 0,d=void 0;i.isEntity&&(a=i.getObject3D("mesh"))&&(s.setFromObject(a).getSize(n),d=Math.max(n.x,n.y,n.z)/2,r=Math.sqrt(2*d*d),s.getCenter(e),r&&(c=t.distanceTo(e))o.get(e)?1:-1}).forEach(this.handleHit),0===l.length&&r.emit("hit",{el:null}),this.collisions.filter(function(t){return!o.has(t)}).forEach(this.handleHitEnd),this.collisions=l)}}(),handleHit:function(t){t.emit("hit"),t.addState(this.data.state),this.el.emit("hit",{el:t})},handleHitEnd:function(t){t.emit("hitend"),t.removeState(this.data.state),this.el.emit("hitend",{el:t})}})},{}]},{},[1]);