diff --git a/README.md b/README.md index c439b8c..c92f6b4 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ This is a fully functional example of what A-Frame code looks like. - + - * + * * * * @@ -96,7 +96,7 @@ * */ AFRAME.registerComponent('altspace', { - version: '1.3.0', + version: '1.3.1', schema: { usePixelScale: { type: 'boolean', default: 'false'}, verticalAlign: { type: 'string', default: 'middle'}, @@ -398,6 +398,14 @@ * @namespace native */ (function () { + if (!window.altspace || !altspace.inClient) { + var noop = function () {}; + window.altspace = { + addNativeComponent: noop, + updateNativeComponent: noop, + removeNativeComponent: noop + }; + } var placeholderGeometry = new THREE.BoxGeometry(0.001, 0.001, 0.001); var placeholderMaterial = new THREE.MeshBasicMaterial({ color: 0x000000 }); @@ -408,16 +416,22 @@ PlaceholderMesh.prototype = Object.create( THREE.Mesh.prototype ); PlaceholderMesh.prototype.constructor = THREE.PlaceholderMesh; - function nativeComponentInit() { - var mesh = this.el.getOrCreateObject3D('mesh', PlaceholderMesh); - + function meshInit(mesh) { //If you attach native components to an entity, it will not use a default collider mesh.userData.altspace = mesh.userData.altspace || {}; mesh.userData.altspace.collider = mesh.userData.altspace.collider || {}; mesh.userData.altspace.collider.enabled = false; altspace.addNativeComponent(mesh, this.name); - this.update(this.data);//to pass defaults + } + + function nativeComponentInit() { + var mesh = this.el.getOrCreateObject3D('mesh', PlaceholderMesh); + + meshInit.call(this, mesh); + + //to pass defaults + this.update(this.data); } function nativeComponentRemove() { var mesh = this.el.getObject3D('mesh'); @@ -432,13 +446,13 @@ } /** - * Attach a given native object to this entity. - * @mixin n-object + * Attach a given native object to this entity. + * @mixin n-object * @memberof native - * @prop {string} res - The identifier for the resource you want. This component + * @prop {string} res - The identifier for the resource you want. This component * can accept all resources except for `interactables`. - * @example - */ + * @example + */ AFRAME.registerComponent('n-object', { schema: { res: {type: 'string'} @@ -449,15 +463,15 @@ }); /** - * Create an object that spawns additional copies of itself when grabbed by a user (the copies are not spawners themselves). + * Create an object that spawns additional copies of itself when grabbed by a user (the copies are not spawners themselves). * These copies will be physically interactive and automatically synchronized * between users. - * @mixin n-spawner + * @mixin n-spawner * @memberof native - * @prop {string} res - The identifier for the resource you want. This component + * @prop {string} res - The identifier for the resource you want. This component * can only accept resources of type `interactables`. - * @example - */ + * @example + */ AFRAME.registerComponent('n-spawner', { schema: { res: {type: 'string'} @@ -468,21 +482,21 @@ }); /** - * Creates dynamic 2D text on the entity. The text will wrap automatically based on the width and height provided. - * This text will be clearer than texture-based text and more performant than geometry-based test. - * @mixin n-text + * Creates dynamic 2D text on the entity. The text will wrap automatically based on the width and height provided. + * This text will be clearer than texture-based text and more performant than geometry-based test. + * @mixin n-text * @memberof native - * @prop {string} text - The text to be drawn. - * @prop {number} fontSize=10 - The height of the letters. 10pt ~= 1m - * @prop {number} width=10 - The width of the text area in meters. If the - * text is wider than this value, the overflow will be wrapped to the next line. - * @prop {number} height=1 - The height of the text area in meters. If the - * text is taller than this value, the overflow will be cut off. - * @prop {string} horizontalAlign=middle - The horizontal anchor point for - * the text. Can be `left`, `middle`, or `right`. - * @prop {string} verticalAlign=middle - The vertical anchor point for the - * text. Can be `top`, `middle`, or `bottom`. - */ + * @prop {string} text - The text to be drawn. + * @prop {number} fontSize=10 - The height of the letters. 10pt ~= 1m + * @prop {number} width=10 - The width of the text area in meters. If the + * text is wider than this value, the overflow will be wrapped to the next line. + * @prop {number} height=1 - The height of the text area in meters. If the + * text is taller than this value, the overflow will be cut off. + * @prop {string} horizontalAlign=middle - The horizontal anchor point for + * the text. Can be `left`, `middle`, or `right`. + * @prop {string} verticalAlign=middle - The vertical anchor point for the + * text. Can be `top`, `middle`, or `bottom`. + */ AFRAME.registerComponent('n-text', { init: nativeComponentInit, update: nativeComponentUpdate, @@ -516,7 +530,7 @@ * @name n-collider * @mixin n-collider * @memberof native - * @prop {vec3} center=0,0,0 - The offset of the collider in local space. + * @prop {vec3} center=0,0,0 - The offset of the collider in local space. * @prop {string} type=hologram - The type of collider, one of: `object` | `environment` | `hologram`. * Object colliders collide with other objects, the environment, and the cursor. * Environment colliders collide with everything objects do, but you can also @@ -524,13 +538,13 @@ * the cursor. */ - /** - * Create a spherical collider on this entity. - * @mixin n-sphere-collider + /** + * Create a spherical collider on this entity. + * @mixin n-sphere-collider * @memberof native * @extends native.n-collider - * @prop {number} radius=1 - The size of the collider in meters. - */ + * @prop {number} radius=1 - The size of the collider in meters. + */ AFRAME.registerComponent('n-sphere-collider', { init:nativeComponentInit, remove: nativeComponentRemove, @@ -545,12 +559,12 @@ /** - * Create a box-shaped collider on this entity. - * @mixin n-box-collider + * Create a box-shaped collider on this entity. + * @mixin n-box-collider * @memberof native * @extends native.n-collider - * @prop {vec3} size=1,1,1 - The dimensions of the collider. - */ + * @prop {vec3} size=1,1,1 - The dimensions of the collider. + */ AFRAME.registerComponent('n-box-collider', { init:nativeComponentInit, remove: nativeComponentRemove, @@ -564,16 +578,16 @@ }); /** - * Create a capsule-shaped collider on this entity. Capsules - * are a union of a cylinder and two spheres on top and bottom. - * @mixin n-capsule-collider + * Create a capsule-shaped collider on this entity. Capsules + * are a union of a cylinder and two spheres on top and bottom. + * @mixin n-capsule-collider * @memberof native * @extends native.n-collider - * @prop {number} radius=1 - The radius of the capsule in meters. - * @prop {number} height=1 - The height of the shaft of the capsule in meters. - * @prop {string} direction=y - The axis with which the capsule is aligned. - * One of `x`, `y`, or `z`. - */ + * @prop {number} radius=1 - The radius of the capsule in meters. + * @prop {number} height=1 - The height of the shaft of the capsule in meters. + * @prop {string} direction=y - The axis with which the capsule is aligned. + * One of `x`, `y`, or `z`. + */ AFRAME.registerComponent('n-capsule-collider', { init:nativeComponentInit, remove: nativeComponentRemove, @@ -589,17 +603,60 @@ }); /** - * Enable collision for the entire attached mesh. This is expensive to evaluate, so should only be used on - * low-poly meshes. - * @mixin n-mesh-collider + * Enable collision for the entire attached mesh. This is expensive to evaluate, so should only be used on + * low-poly meshes. + * @mixin n-mesh-collider * @memberof native * @extends native.n-collider - * @example - */ + * @example + * @prop {bool} convex=true - Whether the collider should be convex or concave. Set this to false if you have holes + * in your mesh. Convex colliders are limited to 255 triangles. Note: concave colliders can be significantly more + * expensive comparet to conves colliders. + */ AFRAME.registerComponent('n-mesh-collider', { - init:nativeComponentInit, - remove: nativeComponentRemove, - update: nativeComponentUpdate, + _forEachMesh: function (func) { + var obj = this.el.object3DMap.mesh; + if (!obj) { return; } + if (obj instanceof THREE.Mesh) { + func(obj); + } + obj.traverse(function (childObj) { + if (childObj instanceof THREE.Mesh) { + func(childObj); + } + }.bind(this)); + }, + _initObj: function () { + this._forEachMesh(function (mesh) { + meshInit.call(this, mesh); + + //to pass defaults + altspace.updateNativeComponent(mesh, this.name, this.data); + }.bind(this)); + }, + init: function () { + // Allow a-frame to create a PlaceholderMesh if there isn't already one, so that the native collider is + // registered. + this.el.getOrCreateObject3D('mesh', PlaceholderMesh); + + // Initialize the existing mesh + this._initObj(); + + this.el.addEventListener('model-loaded', function () { + // Re-initialize the collider if a new model is loaded + this._initObj(); + }.bind(this)); + }, + remove: function () { + this._forEachMesh(function (mesh) { + altspace.removeNativeComponent(mesh, this.name); + }.bind(this)); + }, + update: function (oldData) { + this._forEachMesh(function (mesh) { + altspace.updateNativeComponent(mesh, this.name, this.data); + }.bind(this)); + }, schema: { isTrigger: { default: false, type: 'boolean' }, convex: { default: true, type: 'boolean' }, @@ -608,26 +665,26 @@ }); /** - * Make the object's +Z always face the viewer. Currently will only directly apply to main mesh or native component on the attached entity, not any children or submeshes. - * @mixin n-billboard + * Make the object's +Z always face the viewer. Currently will only directly apply to main mesh or native component on the attached entity, not any children or submeshes. + * @mixin n-billboard * @memberof native - * @example - */ + * @example + */ AFRAME.registerComponent('n-billboard', { init:nativeComponentInit, remove: nativeComponentRemove, }); /** - * A container keeps a running tally of how many objects are within - * its bounds, and adds and removes the states `container-full` and + * A container keeps a running tally of how many objects are within + * its bounds, and adds and removes the states `container-full` and * `container-empty` based on the current count of objects. Can fire three * special events: `container-full`, `container-empty`, and `container-count-changed`. - * @mixin n-container + * @mixin n-container * @memberof native - * @prop {number} capacity=4 - The value at which the container will fire the - * `container-full` event. - */ + * @prop {number} capacity=4 - The value at which the container will fire the + * `container-full` event. + */ AFRAME.registerComponent('n-container', { init: function(){ nativeComponentInit.call(this); @@ -655,12 +712,12 @@ } }); - /** - * Play the sound given by the `src` or `res` property from the location + /** + * Play the sound given by the `src` or `res` property from the location * of the entity. - * @mixin n-sound + * @mixin n-sound * @memberof native - * @prop {string} res - The resource identifier for a built-in sound clip. + * @prop {string} res - The resource identifier for a built-in sound clip. * @prop {string} src - A URL to an external sound clip. The sound can be in WAV, OGG or MP3 format. However. only * WAV is supported on all platforms. MP3 is supported on Gear VR and OGG is supported on desktop. * @prop {string} on - The name of the event that will play this sound clip. @@ -683,7 +740,7 @@ * If rolloff is 'linear' or 'cosine', the sound will be silent at this distance. * @prop {string} rolloff='logarithmic' - Set this to 'linear' or 'cosine' if you want to cut sounds off at a * maxDistance. - */ + */ /** * Fired when a sound has loaded and is ready to be played * @event native.n-sound#n-sound-loaded diff --git a/dist/aframe-altspace-component.min.js b/dist/aframe-altspace-component.min.js old mode 100644 new mode 100755 index ceb5950..10c7459 --- a/dist/aframe-altspace-component.min.js +++ b/dist/aframe-altspace-component.min.js @@ -1 +1 @@ -!function(e){function t(i){if(n[i])return n[i].exports;var a=n[i]={exports:{},id:i,loaded:!1};return e[i].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");n(3),n(1),n(2),n(4),n(5),n(10),n(8),n(9),n(6),n(7),n(11)},function(e,t){!function(){function e(e,t){e.userData.altspace={collider:{enabled:t}},e.traverse(function(e){e instanceof THREE.Mesh&&(e.userData.altspace={collider:{enabled:t}})})}AFRAME.registerComponent("altspace-cursor-collider",{schema:{enabled:{"default":!0}},init:function(){e(this.el.object3D,this.data.enabled),this.el.addEventListener("model-loaded",function(){e(this.el.object3D,this.data.enabled)}.bind(this))},update:function(){e(this.el.object3D,this.data.enabled)}})}()},function(e,t){AFRAME.registerComponent("altspace-tracked-controls",{init:function(){this.gamepadIndex=null,this.trackedControlsSystem=document.querySelector("a-scene").systems["tracked-controls"],this.systemGamepads=0,altspace.getGamepads()},tick:function(){if(this.trackedControlsSystem&&this.systemGamepads!==this.trackedControlsSystem.controllers.length&&window.altspace&&altspace.getGamepads&&altspace.getGamepads().length){var e=this.el.components;e["paint-controls"]&&(this.gamepadIndex="left"===e["paint-controls"].data.hand?2:1),null===this.gamepadIndex&&e["hand-controls"]&&(this.gamepadIndex="left"===e["hand-controls"].data?2:1),null===this.gamepadIndex&&e["vive-controls"]&&(this.gamepadIndex="left"===e["vive-controls"].data.hand?2:1),null===this.gamepadIndex&&e["tracked-controls"]&&(this.gamepadIndex=e["tracked-controls"].data.controller),this.el.setAttribute("tracked-controls","id",altspace.getGamepads()[this.gamepadIndex].id),this.el.setAttribute("tracked-controls","controller",0),this.systemGamepads=this.trackedControlsSystem.controllers.length}}})},function(e,t){AFRAME.registerComponent("altspace",{version:"1.3.0",schema:{usePixelScale:{type:"boolean","default":"false"},verticalAlign:{type:"string","default":"middle"},enclosuresOnly:{type:"boolean","default":"true"},fullspace:{type:"boolean","default":"false"}},init:function(){return this.el.object3D instanceof THREE.Scene?void(window.altspace&&window.altspace.inClient?(this.el.setAttribute("vr-mode-ui",{enabled:!1}),this.initRenderer(),this.initCursorEvents(),this.initCollisionEvents()):console.warn("aframe-altspace-component only works inside of AltspaceVR")):void console.warn("aframe-altspace-component can only be attached to a-scene")},tick:function(e,t){this.el.object3D.updateAllBehaviors&&this.el.object3D.updateAllBehaviors()},remove:function(){},pause:function(){},play:function(){},initRenderer:function(){var e=this.el.object3D;altspace.getEnclosure().then(function(n){switch(this.data.fullspace&&(n.requestFullspace(),n.addEventListener("fullspacechange",function(){e.scale.setScalar(n.pixelsPerMeter)})),this.data.usePixelScale&&!this.data.fullspace||e.scale.setScalar(n.pixelsPerMeter),this.data.verticalAlign){case"bottom":e.position.y-=n.innerHeight/2;break;case"top":e.position.y+=n.innerHeight/2;break;case"middle":break;default:console.warn("Unexpected value for verticalAlign: ",this.data.verticalAlign)}this.data.enclosuresOnly&&1===n.innerDepth&&(this.el.renderer.render(new THREE.Scene),this.el.renderer=this.el.effect=t)}.bind(this));var t=this.el.renderer,n=this.el.renderer=this.el.effect=altspace.getThreeJSRenderer({aframeComponentVersion:this.version}),i=function(){};n.setSize=i,n.setPixelRatio=i,n.setClearColor=i,n.clear=i,n.enableScissorTest=i,n.setScissor=i,n.setViewport=i,n.getPixelRatio=i,n.getMaxAnisotropy=i,n.setFaceCulling=i,n.context={canvas:{}},n.shadowMap={}},initCursorEvents:function(){var e=this.el.object3D,t=document.querySelector("a-cursor")||document.querySelector("a-entity[cursor]");t&&(t.setAttribute("material","transparent",!0),t.setAttribute("material","opacity",0));var n=function(e,n){var i=n.target.el;t&&t.emit(e,{target:i,ray:n.ray,point:n.point}),i&&i.emit(e,{target:i,ray:n.ray,point:n.point})},i=null;e.addEventListener("cursordown",function(e){i=e.target,n("mousedown",e)}),e.addEventListener("cursorup",function(e){n("mouseup",e),e.target.uuid===i.uuid&&n("click",e),i=null}),e.addEventListener("cursorenter",function(e){e.target.el&&(e.target.el.addState("hovered"),t&&t.addState("hovering"),n("mouseenter",e))}),e.addEventListener("cursorleave",function(e){e.target.el&&(e.target.el.removeState("hovered"),t&&t.removeState("hovering"),n("mouseleave",e))})},initCollisionEvents:function(){var e=this.el.object3D,t=function(e,t){var n=t.target.el;n&&(t.target=n,t.other&&t.other.el&&(t.other=t.other.el),n.emit(e,t))};e.addEventListener("collisionenter",function(e){t("collisionenter",e)}),e.addEventListener("collisionexit",function(e){t("collisionexit",e)}),e.addEventListener("triggerenter",function(e){t("triggerenter",e)}),e.addEventListener("triggerexit",function(e){t("triggerexit",e)})}})},function(e,t){!function(){function e(){var e=this.el.getOrCreateObject3D("mesh",o);e.userData.altspace=e.userData.altspace||{},e.userData.altspace.collider=e.userData.altspace.collider||{},e.userData.altspace.collider.enabled=!1,altspace.addNativeComponent(e,this.name),this.update(this.data)}function t(){var e=this.el.getObject3D("mesh");altspace.removeNativeComponent(e,this.name)}function n(e){altspace.updateNativeComponent(this.el.object3DMap.mesh,this.name,this.data)}function i(e,t){altspace.callNativeComponent(this.el.object3DMap.mesh,this.name,e,t)}var a=new THREE.BoxGeometry(.001,.001,.001),s=new THREE.MeshBasicMaterial({color:0});s.visible=!1;var o=function(){THREE.Mesh.call(this,a,s)};o.prototype=Object.create(THREE.Mesh.prototype),o.prototype.constructor=THREE.PlaceholderMesh,AFRAME.registerComponent("n-object",{schema:{res:{type:"string"}},init:e,update:n,remove:t}),AFRAME.registerComponent("n-spawner",{schema:{res:{type:"string"}},init:e,update:n,remove:t}),AFRAME.registerComponent("n-text",{init:e,update:n,remove:t,schema:{text:{"default":"",type:"string"},fontSize:{"default":"10",type:"int"},width:{"default":"10",type:"number"},height:{"default":"1",type:"number"},horizontalAlign:{"default":"middle"},verticalAlign:{"default":"middle"}}}),AFRAME.registerComponent("n-sphere-collider",{init:e,remove:t,update:n,schema:{isTrigger:{"default":!1,type:"boolean"},center:{type:"vec3"},radius:{"default":"0",type:"number"},type:{"default":"object"}}}),AFRAME.registerComponent("n-box-collider",{init:e,remove:t,update:n,schema:{isTrigger:{"default":!1,type:"boolean"},center:{type:"vec3"},size:{type:"vec3"},type:{"default":"object"}}}),AFRAME.registerComponent("n-capsule-collider",{init:e,remove:t,update:n,schema:{isTrigger:{"default":!1,type:"boolean"},center:{type:"vec3"},radius:{"default":"0",type:"number"},height:{"default":"0",type:"number"},direction:{"default":"y"},type:{"default":"object"}}}),AFRAME.registerComponent("n-mesh-collider",{init:e,remove:t,update:n,schema:{isTrigger:{"default":!1,type:"boolean"},convex:{"default":!0,type:"boolean"},type:{"default":"object"}}}),AFRAME.registerComponent("n-billboard",{init:e,remove:t}),AFRAME.registerComponent("n-container",{init:function(){e.call(this);var t=this.el,n=this;t.addEventListener("stateadded",function(e){"container-full"===e.detail.state&&t.emit("container-full"),"container-empty"===e.detail.state&&t.emit("container-empty")}),t.addEventListener("container-count-changed",function(e){n.count=e.detail.count})},remove:t,update:n,schema:{capacity:{"default":4,type:"number"}}}),AFRAME.registerComponent("n-sound",{init:function(){var t=this.data.src;if(t&&!t.startsWith("http"))if(t.startsWith("/"))this.data.src=location.origin+t;else{var n=location.pathname;n.endsWith("/")||(n=location.pathname.split("/").slice(0,-1).join("/")+"/"),this.data.src=location.origin+n+t}e.call(this)},pauseSound:function(){i.call(this,"pause"),this.el.emit("sound-paused")},playSound:function(){i.call(this,"play"),this.el.emit("sound-played")},seek:function(e){i.call(this,"seek",{time:e})},remove:function(){t.call(this),this.playHandler&&this.el.removeEventListener(oldData.on,this.playHandler)},update:function(e){n.call(this,e),this.playHandler&&this.el.removeEventListener(e.on,this.playHandler),this.data.on&&(this.playHandler=this.playSound.bind(this),this.el.addEventListener(this.data.on,this.playHandler))},schema:{on:{type:"string"},res:{type:"string"},src:{type:"string"},loop:{type:"boolean"},volume:{type:"number","default":1},autoplay:{type:"boolean"},oneshot:{type:"boolean"},spatialBlend:{type:"float","default":1},pitch:{type:"float","default":1},minDistance:{type:"float","default":1},maxDistance:{type:"float","default":12},rolloff:{type:"string","default":"logarithmic"}}})}()},function(e,t){},function(e,t){AFRAME.registerComponent("sync-color",{dependencies:["sync"],schema:{},init:function(){function e(){var e=n.dataRef.child("material/color"),i=!1,a=!0;t.el.addEventListener("componentchanged",function(t){var a=t.detail.name,s=t.detail.oldData,o=t.detail.newData;"material"===a&&(i||s.color!==o.color&&n.isMine&&setTimeout(function(){e.set(o.color)},0))}),e.on("value",function(e){if(!n.isMine||a){var s=e.val();i=!0,t.el.setAttribute("material","color",s),i=!1,a=!1}})}var t=this,n=t.el.components.sync;n.isConnected?e():t.el.addEventListener("connected",e)}})},function(e,t){AFRAME.registerComponent("sync-n-sound",{dependencies:["sync"],schema:{},init:function(){function e(){function e(e){if(n.isMine){var e={type:e.type,sender:a.clientId,el:t.el.id,time:Date.now()};t.soundEventRef.set(e)}}t.soundStateRef=n.dataRef.child("sound/state"),t.soundEventRef=n.dataRef.child("sound/event"),t.el.addEventListener("sound-played",e),t.el.addEventListener("sound-paused",e),t.soundEventRef.on("value",function(e){if(!n.isMine){var i=e.val();if(i&&i.el===t.el.id){var a=t.el.components["n-sound"];"sound-played"===i.type?a.playSound():a.pauseSound()}}}),t.el.addEventListener("componentchanged",function(e){if(n.isMine){var i=e.detail.name;"n-sound"===i&&t.soundStateRef.set(e.detail.newData)}}),t.soundStateRef.on("value",function(e){if(!n.isMine){var i=e.val();i&&t.el.setAttribute("n-sound",i)}})}var t=this,n=t.el.components.sync,i=document.querySelector("a-scene"),a=i.systems["sync-system"];n.isConnected?e():t.el.addEventListener("connected",e)},remove:function(){this.soundStateRef.off("value"),this.soundEventRef.off("value")}})},function(e,t){AFRAME.registerSystem("sync-system",{schema:{author:{type:"string","default":null},app:{type:"string","default":null},instance:{type:"string","default":null},refUrl:{type:"string","default":null}},init:function(){var e=this;return this.data&&this.data.app?(e.isConnected=!1,console.log(this.data),void altspace.utilities.sync.connect({authorId:this.data.author,appId:this.data.app,instanceId:this.data.instance,baseRefUrl:this.data.refUrl}).then(function(t){this.connection=t,this.sceneRef=this.connection.instance.child("scene"),this.clientsRef=this.connection.instance.child("clients"),this.clientId=this.sceneEl.object3D.uuid;var n;this.clientsRef.on("value",function(e){var t=e.val(),i=Object.keys(t)[0];n=t[i]}),this.clientsRef.on("child_added",function(t){var n=t.val();setTimeout(function(){e.sceneEl.emit("clientjoined",{id:n},!1)},0)}),this.clientsRef.on("child_removed",function(t){var n=t.val();setTimeout(function(){e.sceneEl.emit("clientleft",{id:n},!1)},0)}),this.clientsRef.push(this.clientId).onDisconnect().remove(),this.connection.instance.child("initialized").once("value",function(t){var n=!t.val();t.ref().set(!0),e.sceneEl.emit("connected",{shouldInitialize:n},!1),e.isConnected=!0}.bind(this)),Object.defineProperty(this,"isMasterClient",{get:function(){return n===this.clientId}.bind(this)})}.bind(this))):void console.warn("The sync-system must be present on the scene and configured with required data.")}})},function(e,t){AFRAME.registerComponent("sync-transform",{dependencies:["sync"],schema:{},init:function(){function e(){function e(e,i){if(!n.isMine){var a=e.val();a&&t.el.setAttribute(i,a)}}function i(e){if(n.isMine){var t=e.detail.name,i=e.detail.newData;if("position"===t)c(i);else if("rotation"===t)d(i);else{if("scale"!==t)return;u(i)}}}function a(e,t,n){var i,a,s,o,r=0;n||(n={});var l=function(){r=n.leading===!1?0:Date.now(),i=null,o=e.apply(a,s),i||(a=s=null)},c=function(){var c=Date.now();r||n.leading!==!1||(r=c);var d=t-(c-r);return a=this,s=arguments,d<=0||d>t?(i&&(clearTimeout(i),i=null),r=c,o=e.apply(a,s),i||(a=s=null)):i||n.trailing===!1||(i=setTimeout(l,d)),o};return c.cancel=function(){clearTimeout(i),r=0,i=a=s=null},c}var s=n.dataRef.child("position"),o=n.dataRef.child("rotation"),r=n.dataRef.child("scale");t.updateRate=100;var l=[];t.el.addEventListener("ownershiplost",function(){for(var e=t.el.children,n=0;nt?(i&&(clearTimeout(i),i=null),r=c,o=e.apply(a,s),i||(a=s=null)):i||n.trailing===!1||(i=setTimeout(l,d)),o};return c.cancel=function(){clearTimeout(i),r=0,i=a=s=null},c}var s=n.dataRef.child("position"),o=n.dataRef.child("rotation"),r=n.dataRef.child("scale");t.updateRate=100;var l=[];t.el.addEventListener("ownershiplost",function(){for(var e=t.el.children,n=0;nQuick Start

This is a fully functional example of what A-Frame code l

<!DOCTYPE html>
 <html><head>
 <script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script>
-<script src="https://cdn.rawgit.com/AltspaceVR/aframe-altspace-component/v1.3.0/dist/aframe-altspace-component.min.js"></script>
+<script src="https://cdn.rawgit.com/AltspaceVR/aframe-altspace-component/v1.3.1/dist/aframe-altspace-component.min.js"></script>
 <script>
 
 // an example custom component, that will change the color when clicked
diff --git a/doc/native.n-mesh-collider.html b/doc/native.n-mesh-collider.html
index a4dbd0f..2e6ed73 100644
--- a/doc/native.n-mesh-collider.html
+++ b/doc/native.n-mesh-collider.html
@@ -60,6 +60,68 @@ 

+

Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDefaultDescription
convex + + +bool + + + + + + true + +

Whether the collider should be convex or concave. Set this to false if you have holes +in your mesh. Convex colliders are limited to 255 triangles. Note: concave colliders can be significantly more +expensive comparet to conves colliders.

+ + + +
diff --git a/examples/index.html b/examples/index.html old mode 100644 new mode 100755 index b8bc094..3ca3ded --- a/examples/index.html +++ b/examples/index.html @@ -22,6 +22,7 @@ 'moon/index.html', 'native/index.html', 'native-sound/index.html', + 'test-mesh-collider/index.html', 'test-cursor-events/index.html', 'test-fullspace/index.html', 'test-meter-scale/index.html', diff --git a/examples/test-mesh-collider/index.html b/examples/test-mesh-collider/index.html new file mode 100755 index 0000000..fdaf80f --- /dev/null +++ b/examples/test-mesh-collider/index.html @@ -0,0 +1,41 @@ + + + + + Mesh Collider Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/test-mesh-collider/models/ConeImg.jpg b/examples/test-mesh-collider/models/ConeImg.jpg new file mode 100644 index 0000000..e420ef1 Binary files /dev/null and b/examples/test-mesh-collider/models/ConeImg.jpg differ diff --git a/examples/test-mesh-collider/models/CubeImg.jpg b/examples/test-mesh-collider/models/CubeImg.jpg new file mode 100644 index 0000000..becad12 Binary files /dev/null and b/examples/test-mesh-collider/models/CubeImg.jpg differ diff --git a/examples/test-mesh-collider/models/CylImg.jpg b/examples/test-mesh-collider/models/CylImg.jpg new file mode 100644 index 0000000..cb9d1fd Binary files /dev/null and b/examples/test-mesh-collider/models/CylImg.jpg differ diff --git a/examples/test-mesh-collider/models/DoorImg.jpg b/examples/test-mesh-collider/models/DoorImg.jpg new file mode 100644 index 0000000..5af17a1 Binary files /dev/null and b/examples/test-mesh-collider/models/DoorImg.jpg differ diff --git a/examples/test-mesh-collider/models/test.blend b/examples/test-mesh-collider/models/test.blend new file mode 100644 index 0000000..bd87dee Binary files /dev/null and b/examples/test-mesh-collider/models/test.blend differ diff --git a/examples/test-mesh-collider/models/test.dae b/examples/test-mesh-collider/models/test.dae new file mode 100644 index 0000000..fbe73d6 --- /dev/null +++ b/examples/test-mesh-collider/models/test.dae @@ -0,0 +1,417 @@ + + + + + Blender User + Blender 2.77.0 commit date:2016-04-05, commit time:18:12, hash:abf6f08 + + 2017-01-05T01:23:21 + 2017-01-05T01:23:21 + + Z_UP + + + + ConeImg.jpg + + + CylImg.jpg + + + CubeImg.jpg + + + DoorImg.jpg + + + + + + + + ConeImg + + + + + ConeImg-surface + + + + + + 0 0 0 1 + + + 0 0 0 1 + + + + + + 0.5 0.5 0.5 1 + + + 50 + + + 1 + + + + + + + + + + CylImg + + + + + CylImg-surface + + + + + + 0 0 0 1 + + + 0 0 0 1 + + + + + + 0.5 0.5 0.5 1 + + + 50 + + + 1 + + + + + + + + + + CubeImg + + + + + CubeImg-surface + + + + + + 0 0 0 1 + + + 0 0 0 1 + + + + + + 0.5 0.5 0.5 1 + + + 50 + + + 1 + + + + + + + + + + DoorImg + + + + + DoorImg-surface + + + + + + 0 0 0 1 + + + 0 0 0 1 + + + + + + 0.5 0.5 0.5 1 + + + 50 + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + 0 1 -1 0.1950903 0.9807853 -1 0.3826835 0.9238795 -1 0.5555703 0.8314696 -1 0.7071068 0.7071068 -1 0.8314697 0.5555702 -1 0.9238795 0.3826834 -1 0.9807853 0.1950903 -1 1 0 -1 0 0 1 0.9807853 -0.1950902 -1 0.9238796 -0.3826833 -1 0.8314697 -0.5555702 -1 0.7071068 -0.7071068 -1 0.5555702 -0.8314697 -1 0.3826833 -0.9238796 -1 0.1950901 -0.9807853 -1 -3.25841e-7 -1 -1 -0.1950907 -0.9807852 -1 -0.3826839 -0.9238793 -1 -0.5555707 -0.8314693 -1 -0.7071073 -0.7071064 -1 -0.83147 -0.5555697 -1 -0.9238799 -0.3826827 -1 -0.9807854 -0.1950894 -1 -1 9.65599e-7 -1 -0.9807851 0.1950913 -1 -0.9238791 0.3826845 -1 -0.8314689 0.5555713 -1 -0.7071059 0.7071077 -1 -0.5555691 0.8314704 -1 -0.3826821 0.9238801 -1 -0.1950888 0.9807856 -1 + + + + + + + + + + 0.08775365 0.8909768 0.4454883 0.2598883 0.856737 0.4454884 0.4220357 0.7895733 0.4454885 0.5679646 0.6920667 0.4454883 0.6920668 0.5679646 0.4454883 0.7895735 0.4220356 0.4454884 0.856737 0.2598884 0.4454883 0.8909767 0.08775365 0.4454883 0.8909767 -0.08775341 0.4454883 0.856737 -0.2598884 0.4454884 0.7895734 -0.4220355 0.4454883 0.6920668 -0.5679646 0.4454883 0.5679646 -0.6920668 0.4454883 0.4220357 -0.7895733 0.4454883 0.2598879 -0.8567371 0.4454883 0.08775335 -0.8909768 0.4454884 -0.08775389 -0.8909767 0.4454883 -0.2598888 -0.8567368 0.4454884 -0.422036 -0.7895731 0.4454883 -0.5679649 -0.6920665 0.4454885 -0.6920673 -0.567964 0.4454882 -0.7895737 -0.4220352 0.4454885 -0.8567373 -0.2598874 0.4454883 -0.8909768 -0.08775281 0.4454883 -0.8909767 0.08775442 0.4454883 -0.8567367 0.2598893 0.4454884 -0.7895729 0.4220365 0.4454883 -0.6920661 0.5679656 0.4454883 -0.5679637 0.6920675 0.4454883 -0.4220346 0.7895739 0.4454883 -0.2598869 0.8567374 0.4454883 -0.08775299 0.8909768 0.4454884 0 0 -1 -3.97511e-6 0 -1 3.97512e-6 0 -1 3.88857e-7 0 -1 0 0 -1 + + + + + + + + + + 0.4667075 0.386415 0.7277739 0.02067083 0.4928949 0.4082329 0.4928949 0.4082329 0.7277739 0.02067083 0.5234826 0.4282566 0.5234826 0.4282566 0.7277739 0.02067083 0.5572952 0.4457167 0.5572952 0.4457167 0.7277739 0.02067083 0.5930331 0.4599423 0.5930331 0.4599423 0.7277739 0.02067083 0.6293232 0.4703866 0.6293232 0.4703866 0.7277739 0.02067083 0.6647707 0.4766483 0.6647707 0.4766483 0.7277739 0.02067083 0.6980134 0.4784867 0.6980134 0.4784867 0.7277739 0.02067083 0.727774 0.4758312 0.01946961 0.8361985 0.2784058 0.4734387 0.04167783 0.8573989 0.04167783 0.8573989 0.2784058 0.4734387 0.06921792 0.8772507 0.06921792 0.8772507 0.2784058 0.4734387 0.1010316 0.8949909 0.1010316 0.8949909 0.2784058 0.4734387 0.1358962 0.909938 0.1358962 0.909938 0.2784058 0.4734387 0.1724719 0.9215173 0.1724719 0.9215173 0.2784058 0.4734387 0.2093532 0.929284 0.2093532 0.929284 0.2784058 0.4734387 0.2451227 0.9329397 0.2451227 0.9329397 0.2784058 0.4734387 0.2784059 0.9323437 0.7438025 0.9037883 0.9805304 0.5198284 0.7713426 0.9236401 0.7713426 0.9236401 0.9805304 0.5198284 0.8031563 0.9413804 0.8031563 0.9413804 0.9805304 0.5198284 0.8380209 0.9563274 0.8380209 0.9563274 0.9805304 0.5198284 0.8745965 0.9679068 0.8745965 0.9679068 0.9805304 0.5198284 0.9114779 0.9756735 0.9114779 0.9756735 0.9805304 0.5198284 0.9472473 0.9793291 0.9472473 0.9793291 0.9805304 0.5198284 0.9805304 0.9787331 0.7048632 0.5204244 0.7048632 0.9793291 0.6715801 0.5198284 0.6715801 0.5198284 0.7048632 0.9793291 0.6358106 0.523484 0.6358106 0.523484 0.7048632 0.9793291 0.5989294 0.5312507 0.5989294 0.5312507 0.7048632 0.9793291 0.5623536 0.5428301 0.5623536 0.5428301 0.7048632 0.9793291 0.527489 0.557777 0.527489 0.557777 0.7048632 0.9793291 0.4956753 0.5755174 0.4956753 0.5755174 0.7048632 0.9793291 0.4681352 0.5953691 0.4681352 0.5953691 0.7048632 0.9793291 0.445927 0.6165695 0.445927 0.3636417 0.7277739 0.02067083 0.4667075 0.386415 0.3995416 0.1663796 0.269746 0.4241917 0.1567112 0.02857631 0.0269156 0.286388 0.01946967 0.246645 0.01946961 0.2061231 0.01946961 0.2061231 0.02691566 0.1663797 0.0415216 0.1289423 0.0415216 0.1289423 0.06272614 0.09524953 0.0897144 0.06659621 0.0897144 0.06659621 0.1214493 0.04408335 0.0415216 0.1289423 0.1567112 0.02857631 0.194145 0.02067083 0.2323122 0.02067083 0.2323122 0.02067083 0.269746 0.02857625 0.1567112 0.02857631 0.3050079 0.04408329 0.3367428 0.06659609 0.3995416 0.1663796 0.3637311 0.09524941 0.3849357 0.1289422 0.3995416 0.1663796 0.3995416 0.1663796 0.4069877 0.2061229 0.4069877 0.2466449 0.4069877 0.2466449 0.3995416 0.2863883 0.3849357 0.3238257 0.3849357 0.3238257 0.3637311 0.3575184 0.3367428 0.3861718 0.3367428 0.3861718 0.3050079 0.4086846 0.269746 0.4241917 0.269746 0.4241917 0.2323122 0.432097 0.1941449 0.432097 0.1941449 0.432097 0.1567111 0.4241916 0.1214492 0.4086844 0.1214492 0.4086844 0.08971434 0.3861716 0.0269156 0.286388 0.06272608 0.3575183 0.04152154 0.3238254 0.0269156 0.286388 0.0269156 0.286388 0.01946961 0.2061231 0.1567112 0.02857631 0.0415216 0.1289423 0.1214493 0.04408335 0.1567112 0.02857631 0.1567112 0.02857631 0.269746 0.02857625 0.3050079 0.04408329 0.3367428 0.06659609 0.3637311 0.09524941 0.3995416 0.1663796 0.3995416 0.1663796 0.4069877 0.2466449 0.269746 0.4241917 0.3849357 0.3238257 0.3367428 0.3861718 0.269746 0.4241917 0.269746 0.4241917 0.1941449 0.432097 0.0269156 0.286388 0.08971434 0.3861716 0.06272608 0.3575183 0.0269156 0.286388 0.01946961 0.2061231 0.0415216 0.1289423 0.1567112 0.02857631 0.1567112 0.02857631 0.3050079 0.04408329 0.3995416 0.1663796 0.4069877 0.2466449 0.3849357 0.3238257 0.269746 0.4241917 0.1941449 0.432097 0.1214492 0.4086844 0.0269156 0.286388 0.0269156 0.286388 0.1567112 0.02857631 0.269746 0.4241917 + + + + + + + + + + + + + + + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 +

0 0 0 9 0 1 1 0 2 1 1 3 9 1 4 2 1 5 2 2 6 9 2 7 3 2 8 3 3 9 9 3 10 4 3 11 4 4 12 9 4 13 5 4 14 5 5 15 9 5 16 6 5 17 6 6 18 9 6 19 7 6 20 7 7 21 9 7 22 8 7 23 8 8 24 9 8 25 10 8 26 10 9 27 9 9 28 11 9 29 11 10 30 9 10 31 12 10 32 12 11 33 9 11 34 13 11 35 13 12 36 9 12 37 14 12 38 14 13 39 9 13 40 15 13 41 15 14 42 9 14 43 16 14 44 16 15 45 9 15 46 17 15 47 17 16 48 9 16 49 18 16 50 18 17 51 9 17 52 19 17 53 19 18 54 9 18 55 20 18 56 20 19 57 9 19 58 21 19 59 21 20 60 9 20 61 22 20 62 22 21 63 9 21 64 23 21 65 23 22 66 9 22 67 24 22 68 24 23 69 9 23 70 25 23 71 25 24 72 9 24 73 26 24 74 26 25 75 9 25 76 27 25 77 27 26 78 9 26 79 28 26 80 28 27 81 9 27 82 29 27 83 29 28 84 9 28 85 30 28 86 30 29 87 9 29 88 31 29 89 31 30 90 9 30 91 32 30 92 32 31 93 9 31 94 0 31 95 16 32 96 24 32 97 7 32 98 32 32 99 0 32 100 1 32 101 1 32 102 2 32 103 3 32 104 3 32 105 4 32 106 5 32 107 5 32 108 6 32 109 3 32 110 7 32 111 8 32 112 10 32 113 10 32 114 11 32 115 7 32 116 12 32 117 13 32 118 16 32 119 14 32 120 15 32 121 16 32 122 16 32 123 17 32 124 18 32 125 18 32 126 19 32 127 20 32 128 20 32 129 21 32 130 22 32 131 22 32 132 23 32 133 24 32 134 24 33 135 25 33 136 26 33 137 26 34 138 27 34 139 28 34 140 28 32 141 29 32 142 32 32 143 30 32 144 31 32 145 32 32 146 32 32 147 1 32 148 7 32 149 3 32 150 6 32 151 7 32 152 7 32 153 11 32 154 12 32 155 13 32 156 14 32 157 16 32 158 16 32 159 18 32 160 24 32 161 20 32 162 22 32 163 24 32 164 24 35 165 26 35 166 32 35 167 29 32 168 30 32 169 32 32 170 1 32 171 3 32 172 7 32 173 7 32 174 12 32 175 16 32 176 18 32 177 20 32 178 24 32 179 26 32 180 28 32 181 32 32 182 32 36 183 7 36 184 24 36 185

+
+
+
+ + + + 0 1 -1 0 1 1 0.1950903 0.9807853 -1 0.1950903 0.9807853 1 0.3826835 0.9238795 -1 0.3826835 0.9238795 1 0.5555703 0.8314696 -1 0.5555703 0.8314696 1 0.7071068 0.7071068 -1 0.7071068 0.7071068 1 0.8314697 0.5555702 -1 0.8314697 0.5555702 1 0.9238795 0.3826834 -1 0.9238795 0.3826834 1 0.9807853 0.1950903 -1 0.9807853 0.1950903 1 1 0 -1 1 0 1 0.9807853 -0.1950902 -1 0.9807853 -0.1950902 1 0.9238796 -0.3826833 -1 0.9238796 -0.3826833 1 0.8314697 -0.5555702 -1 0.8314697 -0.5555702 1 0.7071068 -0.7071068 -1 0.7071068 -0.7071068 1 0.5555702 -0.8314697 -1 0.5555702 -0.8314697 1 0.3826833 -0.9238796 -1 0.3826833 -0.9238796 1 0.1950901 -0.9807853 -1 0.1950901 -0.9807853 1 -3.25841e-7 -1 -1 -3.25841e-7 -1 1 -0.1950907 -0.9807852 -1 -0.1950907 -0.9807852 1 -0.3826839 -0.9238793 -1 -0.3826839 -0.9238793 1 -0.5555707 -0.8314693 -1 -0.5555707 -0.8314693 1 -0.7071073 -0.7071064 -1 -0.7071073 -0.7071064 1 -0.83147 -0.5555697 -1 -0.83147 -0.5555697 1 -0.9238799 -0.3826827 -1 -0.9238799 -0.3826827 1 -0.9807854 -0.1950894 -1 -0.9807854 -0.1950894 1 -1 9.65599e-7 -1 -1 9.65599e-7 1 -0.9807851 0.1950913 -1 -0.9807851 0.1950913 1 -0.9238791 0.3826845 -1 -0.9238791 0.3826845 1 -0.8314689 0.5555713 -1 -0.8314689 0.5555713 1 -0.7071059 0.7071077 -1 -0.7071059 0.7071077 1 -0.5555691 0.8314704 -1 -0.5555691 0.8314704 1 -0.3826821 0.9238801 -1 -0.3826821 0.9238801 1 -0.1950888 0.9807856 -1 -0.1950888 0.9807856 1 + + + + + + + + + + 0.09801727 0.9951847 0 0.2902846 0.9569405 0 0.4713967 0.8819213 0 0.6343935 0.7730103 0 0.7730106 0.6343932 0 0.8819215 0.4713966 0 0.9569404 0.2902848 0 0.9951847 0.09801727 0 0.9951848 -0.09801667 0 0.9569404 -0.2902848 0 0.8819214 -0.4713968 0 0.7730103 -0.6343936 0 0.6343934 -0.7730104 0 0.4713968 -0.8819214 0 0.2902842 -0.9569405 0 0.09801691 -0.9951848 0 -0.09801757 -0.9951848 0 -0.2902852 -0.9569402 0 -0.4713971 -0.8819211 0 -0.6343939 -0.77301 0 -0.7730109 -0.6343929 0 -0.8819217 -0.4713961 0 -0.9569407 -0.2902834 0 -0.9951849 -0.09801602 0 -0.9951847 0.09801787 0 -0.95694 0.2902858 0 -0.8819208 0.4713979 0 -0.7730096 0.6343944 0 -0.6343926 0.7730111 0 -0.4713955 0.881922 0 0 0 1 -0.290283 0.9569408 0 -0.0980165 0.9951848 0 0 0 -1 0.2902847 0.9569404 0 0.6343932 0.7730106 0 0.7730103 0.6343936 0 0.9951847 -0.09801727 0 0.8819216 -0.4713962 0 0.7730106 -0.6343932 0 0.2902843 -0.9569405 0 -0.2902852 -0.9569402 0 -0.6343936 -0.7730103 0 -0.7730111 -0.6343926 0 -0.9569405 -0.2902839 0 -0.9951848 -0.09801661 0 -0.9951846 0.09801846 0 -0.881921 0.4713975 0 -0.6343923 0.7730113 0 0 0 1 -3.97511e-6 0 1 3.97512e-6 0 1 -1.36853e-6 0 1 1.43703e-6 0 1 -2.87796e-7 0 1 -3.88858e-7 0 1 -0.2902831 0.9569409 0 -3.97511e-6 0 -1 3.97512e-6 0 -1 3.88857e-7 0 -1 0 0 -1 + + + + + + + + + + 0.6002771 0.01519584 0.6367844 0.319113 0.6002772 0.319113 0.6367844 0.0151959 0.6711735 0.319113 0.6367844 0.319113 0.6711735 0.01519584 0.7021229 0.319113 0.6711735 0.319113 0.7021228 0.01519584 0.7284432 0.319113 0.7021229 0.319113 0.7284431 0.01519584 0.7491228 0.319113 0.7284432 0.319113 0.702123 0.6534219 0.6758027 0.3495048 0.702123 0.3495048 0.6758028 0.6534219 0.6448534 0.3495048 0.6758027 0.3495048 0.6448535 0.6534219 0.6104643 0.3495048 0.6448534 0.3495048 0.6104644 0.6534219 0.5739572 0.3495048 0.6104643 0.3495048 0.5739572 0.6534219 0.5367347 0.3495048 0.5739572 0.3495048 0.5367348 0.6534219 0.5002275 0.3495048 0.5367347 0.3495048 0.5002275 0.6534219 0.4658384 0.3495048 0.5002275 0.3495048 0.4658384 0.6534219 0.4348891 0.3495048 0.4658384 0.3495048 0.7400985 0.3495048 0.7710478 0.653422 0.7400985 0.653422 0.7710478 0.3495048 0.8054369 0.653422 0.7710478 0.653422 0.8054369 0.3495048 0.8419442 0.653422 0.8054369 0.653422 0.8419441 0.3495048 0.8791666 0.653422 0.8419442 0.653422 0.8791666 0.3495048 0.9156739 0.653422 0.8791666 0.653422 0.9156739 0.3495048 0.9500629 0.653422 0.9156739 0.653422 0.9500629 0.3495048 0.9810123 0.653422 0.9500629 0.653422 0.01898771 0.6808869 0.05337685 0.9848041 0.01898777 0.9848041 0.05337673 0.6808869 0.0898841 0.9848041 0.05337685 0.9848041 0.08988404 0.6808869 0.1271066 0.9848041 0.0898841 0.9848041 0.1271065 0.6808869 0.1636138 0.9848041 0.1271066 0.9848041 0.1636137 0.6808869 0.1980029 0.9848041 0.1636138 0.9848041 0.1980028 0.6808869 0.2289522 0.9848041 0.1980029 0.9848041 0.2289522 0.6808869 0.2552725 0.984804 0.2289522 0.9848041 0.4348891 0.0151959 0.4612094 0.319113 0.4348891 0.319113 0.4612093 0.0151959 0.4921587 0.319113 0.4612094 0.319113 0.4921587 0.0151959 0.5265479 0.319113 0.4921587 0.319113 0.06117349 0.07002127 0.3284075 0.04895716 0.08749395 0.2838884 0.5265477 0.01519584 0.563055 0.319113 0.5265479 0.319113 0.563055 0.01519584 0.6002772 0.319113 0.563055 0.319113 0.3284075 0.3818026 0.3547277 0.5956698 0.06117349 0.4028667 0.6002771 0.01519584 0.6367844 0.0151959 0.6367844 0.319113 0.6367844 0.0151959 0.6711735 0.01519584 0.6711735 0.319113 0.6711735 0.01519584 0.7021228 0.01519584 0.7021229 0.319113 0.7021228 0.01519584 0.7284431 0.01519584 0.7284432 0.319113 0.7284431 0.01519584 0.7491228 0.01519584 0.7491228 0.319113 0.702123 0.6534219 0.6758028 0.6534219 0.6758027 0.3495048 0.6758028 0.6534219 0.6448535 0.6534219 0.6448534 0.3495048 0.6448535 0.6534219 0.6104644 0.6534219 0.6104643 0.3495048 0.6104644 0.6534219 0.5739572 0.6534219 0.5739572 0.3495048 0.5739572 0.6534219 0.5367348 0.6534219 0.5367347 0.3495048 0.5367348 0.6534219 0.5002275 0.6534219 0.5002275 0.3495048 0.5002275 0.6534219 0.4658384 0.6534219 0.4658384 0.3495048 0.4658384 0.6534219 0.4348891 0.6534219 0.4348891 0.3495048 0.7400985 0.3495048 0.7710478 0.3495048 0.7710478 0.653422 0.7710478 0.3495048 0.8054369 0.3495048 0.8054369 0.653422 0.8054369 0.3495048 0.8419441 0.3495048 0.8419442 0.653422 0.8419441 0.3495048 0.8791666 0.3495048 0.8791666 0.653422 0.8791666 0.3495048 0.9156739 0.3495048 0.9156739 0.653422 0.9156739 0.3495048 0.9500629 0.3495048 0.9500629 0.653422 0.9500629 0.3495048 0.9810123 0.3495048 0.9810123 0.653422 0.01898771 0.6808869 0.05337673 0.6808869 0.05337685 0.9848041 0.05337673 0.6808869 0.08988404 0.6808869 0.0898841 0.9848041 0.08988404 0.6808869 0.1271065 0.6808869 0.1271066 0.9848041 0.1271065 0.6808869 0.1636137 0.6808869 0.1636138 0.9848041 0.1636137 0.6808869 0.1980028 0.6808869 0.1980029 0.9848041 0.1980028 0.6808869 0.2289522 0.6808869 0.2289522 0.9848041 0.2289522 0.6808869 0.2552725 0.6808869 0.2552725 0.984804 0.4348891 0.0151959 0.4612093 0.0151959 0.4612094 0.319113 0.4612093 0.0151959 0.4921587 0.0151959 0.4921587 0.319113 0.4921587 0.0151959 0.5265477 0.01519584 0.5265479 0.319113 0.3547278 0.2628242 0.3284075 0.2838883 0.2974582 0.3004382 0.2974582 0.3004382 0.2630694 0.311838 0.3547278 0.2628242 0.2265622 0.3176496 0.1893396 0.3176496 0.1528324 0.3118381 0.1528324 0.3118381 0.1184433 0.3004384 0.08749395 0.2838884 0.08749395 0.2838884 0.06117367 0.2628244 0.04049396 0.2380556 0.04049396 0.2380556 0.02624946 0.2105341 0.08749395 0.2838884 0.01898771 0.1813174 0.01898771 0.1515282 0.06117349 0.07002127 0.0262494 0.1223115 0.04049378 0.09478998 0.06117349 0.07002127 0.06117349 0.07002127 0.08749371 0.04895716 0.1184431 0.03240722 0.1184431 0.03240722 0.1528322 0.02100741 0.1893394 0.01519584 0.1893394 0.01519584 0.2265619 0.01519584 0.2630691 0.02100741 0.2630691 0.02100741 0.2974582 0.03240722 0.3284075 0.04895716 0.3284075 0.04895716 0.3547278 0.07002121 0.3754075 0.09478998 0.3754075 0.09478998 0.3896518 0.1223115 0.3284075 0.04895716 0.3969136 0.1515282 0.3969136 0.1813173 0.3896518 0.210534 0.3896518 0.210534 0.3754075 0.2380555 0.3547278 0.2628242 0.3547278 0.2628242 0.2630694 0.311838 0.2265622 0.3176496 0.2265622 0.3176496 0.1528324 0.3118381 0.3547278 0.2628242 0.08749395 0.2838884 0.02624946 0.2105341 0.01898771 0.1813174 0.01898771 0.1515282 0.0262494 0.1223115 0.06117349 0.07002127 0.06117349 0.07002127 0.1184431 0.03240722 0.3284075 0.04895716 0.1893394 0.01519584 0.2630691 0.02100741 0.3284075 0.04895716 0.3284075 0.04895716 0.3896518 0.1223115 0.3969136 0.1515282 0.3969136 0.1515282 0.3896518 0.210534 0.3284075 0.04895716 0.3547278 0.2628242 0.1528324 0.3118381 0.08749395 0.2838884 0.08749395 0.2838884 0.01898771 0.1813174 0.06117349 0.07002127 0.1184431 0.03240722 0.1893394 0.01519584 0.3284075 0.04895716 0.3284075 0.04895716 0.3896518 0.210534 0.3547278 0.2628242 0.3547278 0.2628242 0.08749395 0.2838884 0.3284075 0.04895716 0.5265477 0.01519584 0.563055 0.01519584 0.563055 0.319113 0.563055 0.01519584 0.6002771 0.01519584 0.6002772 0.319113 0.08749359 0.6167337 0.06117355 0.5956698 0.0404939 0.570901 0.0404939 0.570901 0.02624946 0.5433795 0.01898771 0.5141628 0.01898771 0.5141628 0.01898771 0.4843737 0.0262494 0.455157 0.0262494 0.455157 0.04049384 0.4276354 0.01898771 0.5141628 0.06117349 0.4028667 0.08749377 0.3818027 0.1184431 0.3652527 0.1184431 0.3652527 0.1528322 0.3538529 0.06117349 0.4028667 0.1893393 0.3480414 0.2265618 0.3480414 0.3284075 0.3818026 0.2630691 0.3538529 0.2974582 0.3652527 0.3284075 0.3818026 0.3284075 0.3818026 0.3547278 0.4028667 0.3754075 0.4276354 0.3754075 0.4276354 0.3896518 0.455157 0.3969136 0.4843737 0.3969136 0.4843737 0.3969136 0.5141628 0.3896518 0.5433796 0.3896518 0.5433796 0.3754074 0.5709011 0.3547277 0.5956698 0.3547277 0.5956698 0.3284074 0.6167339 0.2974581 0.6332838 0.2974581 0.6332838 0.2630689 0.6446835 0.2265617 0.6504951 0.2265617 0.6504951 0.1893392 0.6504951 0.08749359 0.6167337 0.152832 0.6446835 0.1184429 0.6332837 0.08749359 0.6167337 0.08749359 0.6167337 0.0404939 0.570901 0.06117349 0.4028667 0.01898771 0.5141628 0.04049384 0.4276354 0.06117349 0.4028667 0.06117349 0.4028667 0.1528322 0.3538529 0.1893393 0.3480414 0.2265618 0.3480414 0.2630691 0.3538529 0.3284075 0.3818026 0.3284075 0.3818026 0.3754075 0.4276354 0.3547277 0.5956698 0.3969136 0.4843737 0.3896518 0.5433796 0.3547277 0.5956698 0.3547277 0.5956698 0.2974581 0.6332838 0.08749359 0.6167337 0.1893392 0.6504951 0.152832 0.6446835 0.08749359 0.6167337 0.0404939 0.570901 0.01898771 0.5141628 0.06117349 0.4028667 0.06117349 0.4028667 0.1893393 0.3480414 0.3284075 0.3818026 0.3754075 0.4276354 0.3969136 0.4843737 0.3547277 0.5956698 0.2974581 0.6332838 0.2265617 0.6504951 0.08749359 0.6167337 0.08749359 0.6167337 0.06117349 0.4028667 0.3547277 0.5956698 + + + + + + + + + + + + + + + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 +

1 0 0 2 0 1 0 0 2 3 1 3 4 1 4 2 1 5 5 2 6 6 2 7 4 2 8 7 3 9 8 3 10 6 3 11 9 4 12 10 4 13 8 4 14 11 5 15 12 5 16 10 5 17 13 6 18 14 6 19 12 6 20 15 7 21 16 7 22 14 7 23 17 8 24 18 8 25 16 8 26 19 9 27 20 9 28 18 9 29 21 10 30 22 10 31 20 10 32 23 11 33 24 11 34 22 11 35 25 12 36 26 12 37 24 12 38 27 13 39 28 13 40 26 13 41 29 14 42 30 14 43 28 14 44 31 15 45 32 15 46 30 15 47 33 16 48 34 16 49 32 16 50 35 17 51 36 17 52 34 17 53 37 18 54 38 18 55 36 18 56 39 19 57 40 19 58 38 19 59 41 20 60 42 20 61 40 20 62 43 21 63 44 21 64 42 21 65 45 22 66 46 22 67 44 22 68 47 23 69 48 23 70 46 23 71 49 24 72 50 24 73 48 24 74 51 25 75 52 25 76 50 25 77 53 26 78 54 26 79 52 26 80 55 27 81 56 27 82 54 27 83 57 28 84 58 28 85 56 28 86 59 29 87 60 29 88 58 29 89 37 30 90 21 30 91 53 30 92 61 31 93 62 31 94 60 31 95 63 32 96 0 32 97 62 32 98 30 33 99 46 33 100 14 33 101 1 0 102 3 0 103 2 0 104 3 34 105 5 34 106 4 34 107 5 2 108 7 2 109 6 2 110 7 35 111 9 35 112 8 35 113 9 36 114 11 36 115 10 36 116 11 5 117 13 5 118 12 5 119 13 6 120 15 6 121 14 6 122 15 7 123 17 7 124 16 7 125 17 37 126 19 37 127 18 37 128 19 9 129 21 9 130 20 9 131 21 38 132 23 38 133 22 38 134 23 39 135 25 39 136 24 39 137 25 12 138 27 12 139 26 12 140 27 13 141 29 13 142 28 13 143 29 40 144 31 40 145 30 40 146 31 15 147 33 15 148 32 15 149 33 16 150 35 16 151 34 16 152 35 41 153 37 41 154 36 41 155 37 18 156 39 18 157 38 18 158 39 42 159 41 42 160 40 42 161 41 43 162 43 43 163 42 43 164 43 21 165 45 21 166 44 21 167 45 44 168 47 44 169 46 44 170 47 45 171 49 45 172 48 45 173 49 46 174 51 46 175 50 46 176 51 25 177 53 25 178 52 25 179 53 47 180 55 47 181 54 47 182 55 27 183 57 27 184 56 27 185 57 48 186 59 48 187 58 48 188 59 29 189 61 29 190 60 29 191 5 49 192 3 49 193 1 49 194 1 49 195 63 49 196 5 49 197 61 49 198 59 49 199 57 49 200 57 49 201 55 49 202 53 49 203 53 50 204 51 50 205 49 50 206 49 49 207 47 49 208 53 49 209 45 49 210 43 49 211 37 49 212 41 49 213 39 49 214 37 49 215 37 49 216 35 49 217 33 49 218 33 49 219 31 49 220 29 49 221 29 49 222 27 49 223 25 49 224 25 49 225 23 49 226 21 49 227 21 51 228 19 51 229 17 51 230 17 49 231 15 49 232 21 49 233 13 49 234 11 49 235 9 49 236 9 49 237 7 49 238 5 49 239 5 49 240 63 49 241 61 49 242 61 49 243 57 49 244 5 49 245 53 49 246 47 49 247 45 49 248 43 49 249 41 49 250 37 49 251 37 49 252 33 49 253 21 49 254 29 49 255 25 49 256 21 49 257 21 52 258 15 52 259 13 52 260 13 53 261 9 53 262 21 53 263 5 49 264 57 49 265 53 49 266 53 54 267 45 54 268 37 54 269 33 49 270 29 49 271 21 49 272 21 55 273 9 55 274 5 55 275 5 49 276 53 49 277 21 49 278 61 56 279 63 56 280 62 56 281 63 32 282 1 32 283 0 32 284 62 33 285 0 33 286 2 33 287 2 33 288 4 33 289 6 33 290 6 33 291 8 33 292 10 33 293 10 33 294 12 33 295 6 33 296 14 33 297 16 33 298 18 33 299 18 33 300 20 33 301 14 33 302 22 33 303 24 33 304 30 33 305 26 33 306 28 33 307 30 33 308 30 33 309 32 33 310 34 33 311 34 33 312 36 33 313 38 33 314 38 33 315 40 33 316 42 33 317 42 33 318 44 33 319 46 33 320 46 57 321 48 57 322 50 57 323 50 58 324 52 58 325 54 58 326 54 33 327 56 33 328 62 33 329 58 33 330 60 33 331 62 33 332 62 33 333 2 33 334 14 33 335 6 33 336 12 33 337 14 33 338 14 33 339 20 33 340 22 33 341 24 33 342 26 33 343 30 33 344 30 33 345 34 33 346 46 33 347 38 33 348 42 33 349 46 33 350 46 59 351 50 59 352 62 59 353 56 33 354 58 33 355 62 33 356 2 33 357 6 33 358 14 33 359 14 33 360 22 33 361 30 33 362 34 33 363 38 33 364 46 33 365 50 33 366 54 33 367 62 33 368 62 60 369 14 60 370 46 60 371

+
+
+
+ + + + 1 1 -1 1 -1 -1 -1 -0.9999998 -1 -0.9999997 1 -1 1 0.9999995 1 0.9999994 -1.000001 1 -1 -0.9999997 1 -1 1 1 + + + + + + + + + + 0 0 -1 0 0 1 1 0 -2.38419e-7 0 -1 -4.76837e-7 -1 2.38419e-7 -1.49012e-7 2.68221e-7 1 2.38419e-7 0 0 -1 0 0 1 1 -5.96046e-7 3.27825e-7 -4.76837e-7 -1 0 -1 2.38419e-7 -1.19209e-7 2.08616e-7 1 0 + + + + + + + + + + 0.0151515 0.6818183 0.3181818 0.9848484 0.0151515 0.9848484 0.6515151 0.6515152 0.3484848 0.3484849 0.6515151 0.3484849 0.3484849 0.3181818 0.6515151 0.0151515 0.6515152 0.3181818 0.0151515 0.01515161 0.3181818 0.3181817 0.0151515 0.3181819 0.3181818 0.6515152 0.0151515 0.3484849 0.3181818 0.3484849 0.9848485 0.0151515 0.6818183 0.3181818 0.6818183 0.0151515 0.0151515 0.6818183 0.3181818 0.6818182 0.3181818 0.9848484 0.6515151 0.6515152 0.3484849 0.6515151 0.3484848 0.3484849 0.3484849 0.3181818 0.3484848 0.0151515 0.6515151 0.0151515 0.0151515 0.01515161 0.3181817 0.0151515 0.3181818 0.3181817 0.3181818 0.6515152 0.0151515 0.6515152 0.0151515 0.3484849 0.9848485 0.0151515 0.9848486 0.3181817 0.6818183 0.3181818 + + + + + + + + + + + + + + + 3 3 3 3 3 3 3 3 3 3 3 3 +

0 0 0 2 0 1 3 0 2 7 1 3 5 1 4 4 1 5 4 2 6 1 2 7 0 2 8 5 3 9 2 3 10 1 3 11 2 4 12 7 4 13 3 4 14 0 5 15 7 5 16 4 5 17 0 6 18 1 6 19 2 6 20 7 7 21 6 7 22 5 7 23 4 8 24 5 8 25 1 8 26 5 9 27 6 9 28 2 9 29 2 10 30 6 10 31 7 10 32 0 11 33 3 11 34 7 11 35

+
+
+
+ + + + -0.6934695 0.2044519 1.338684 0.6934695 -0.2044519 -1.338684 -1 -0.2044519 -1.930415 -1 -0.2044519 1.930415 -1 0.2044519 1.930415 -1 0.2044519 -1.930415 1 0.2044519 1.930415 1 0.2044519 -1.930415 1 -0.2044519 1.930415 1 -0.2044519 -1.930415 -0.6934695 -0.2044519 -1.338684 0.6934695 0.2044519 1.338684 -0.6934695 -0.2044519 1.338684 -0.6934695 0.2044519 -1.338684 0.6934695 0.2044519 -1.338684 0.6934695 -0.2044519 1.338684 + + + + + + + + + + -1 0 0 1 0 0 0 0 -1 0 0 1 0 -1 0 0 1 0 0 1 0 0 1 0 0 -1 0 0 -1 0 + + + + + + + + + + 0.7883621 0.01597231 0.7226929 0.6326366 0.7226928 0.01597231 0.8204818 0.6326366 0.8861511 0.01597231 0.8861511 0.6326366 0.01605987 0.9840276 0.08172911 0.6645812 0.08172917 0.9840276 0.1795181 0.6645812 0.1138489 0.9840276 0.1138488 0.6645812 0.6413448 0.1104855 0.6905732 0.6326364 0.6413449 0.5381233 0.06528824 0.5381233 0.01605981 0.01597237 0.06528812 0.1104855 0.06528812 0.1104855 0.3372566 0.01597231 0.2880282 0.1104855 0.2880282 0.1104855 0.3372567 0.6326364 0.2880284 0.5381233 0.2880284 0.5381233 0.01605993 0.6326366 0.06528824 0.5381233 0.4186047 0.5381233 0.3693764 0.01597231 0.4186046 0.1104855 0.4186046 0.1104855 0.6905731 0.01597231 0.6413448 0.1104855 0.6413449 0.5381233 0.3693764 0.6326365 0.4186047 0.5381233 0.2773072 0.8861076 0.2116378 0.6645812 0.2773071 0.6645812 0.3094268 0.6645812 0.3750962 0.8861076 0.3094269 0.8861076 0.9839401 0.4755548 0.9182708 0.9031926 0.9182708 0.4755548 0.9182709 0.4436101 0.9839401 0.01597231 0.9839402 0.4436101 0.7883621 0.01597231 0.7883622 0.6326366 0.7226929 0.6326366 0.8204818 0.6326366 0.8204818 0.01597231 0.8861511 0.01597231 0.01605987 0.9840276 0.01605981 0.6645812 0.08172911 0.6645812 0.1795181 0.6645812 0.1795182 0.9840276 0.1138489 0.9840276 0.6413448 0.1104855 0.6905731 0.01597231 0.6905732 0.6326364 0.06528824 0.5381233 0.01605993 0.6326366 0.01605981 0.01597237 0.06528812 0.1104855 0.01605981 0.01597237 0.3372566 0.01597231 0.2880282 0.1104855 0.3372566 0.01597231 0.3372567 0.6326364 0.2880284 0.5381233 0.3372567 0.6326364 0.01605993 0.6326366 0.4186047 0.5381233 0.3693764 0.6326365 0.3693764 0.01597231 0.4186046 0.1104855 0.3693764 0.01597231 0.6905731 0.01597231 0.6413449 0.5381233 0.6905732 0.6326364 0.3693764 0.6326365 0.2773072 0.8861076 0.2116379 0.8861076 0.2116378 0.6645812 0.3094268 0.6645812 0.3750961 0.6645812 0.3750962 0.8861076 0.9839401 0.4755548 0.9839401 0.9031926 0.9182708 0.9031926 0.9182709 0.4436101 0.9182708 0.01597231 0.9839401 0.01597231 + + + + + + + + + + + + + + + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 +

4 0 0 2 0 1 3 0 2 8 1 3 7 1 4 6 1 5 5 2 6 9 2 7 2 2 8 6 3 9 3 3 10 8 3 11 12 4 12 2 4 13 10 4 14 13 5 15 4 5 16 0 5 17 0 6 18 6 6 19 11 6 20 11 5 21 7 5 22 14 5 23 14 7 24 5 7 25 13 7 26 1 4 27 8 4 28 15 4 29 15 8 30 3 8 31 12 8 32 10 9 33 9 9 34 1 9 35 13 3 36 1 3 37 14 3 38 11 2 39 12 2 40 0 2 41 13 1 42 12 1 43 10 1 44 1 0 45 11 0 46 14 0 47 4 0 48 5 0 49 2 0 50 8 1 51 9 1 52 7 1 53 5 2 54 7 2 55 9 2 56 6 3 57 4 3 58 3 3 59 12 4 60 3 4 61 2 4 62 13 5 63 5 5 64 4 5 65 0 5 66 4 5 67 6 5 68 11 5 69 6 5 70 7 5 71 14 5 72 7 5 73 5 5 74 1 4 75 9 4 76 8 4 77 15 4 78 8 4 79 3 4 80 10 4 81 2 4 82 9 4 83 13 3 84 10 3 85 1 3 86 11 2 87 15 2 88 12 2 89 13 1 90 0 1 91 12 1 92 1 0 93 15 0 94 11 0 95

+
+
+
+
+ + + + + 1 0 0 0 0 1 0 0.02290223 0 0 1 0 0 0 0 1 + + + + + + + + + + + 1 0 0 0 0 1 0 1.4441 0 0 1 1.389111 0 0 0 1 + + + + + + + + + + + 1 0 0 0 0 1 0 -1.21419 0 0 1 1.6383 0 0 0 1 + + + + + + + + + + + + + + 1 0 0 2.39654 0 1 0 0.5878255 0 0 1 0.98413 0 0 0 1 + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/examples/test-mesh-collider/models/test.mtl b/examples/test-mesh-collider/models/test.mtl new file mode 100644 index 0000000..8bd9710 --- /dev/null +++ b/examples/test-mesh-collider/models/test.mtl @@ -0,0 +1,46 @@ +# Blender MTL File: 'test.blend' +# Material Count: 4 + +newmtl ConeMat +Ns 96.078431 +Ka 1.000000 1.000000 1.000000 +Kd 1 1 1 +Ks 0.500000 0.500000 0.500000 +Ke 0.000000 0.000000 0.000000 +Ni 1.000000 +d 1.000000 +illum 2 +map_Kd ConeImg.jpg + +newmtl CubeMat +Ns 96.078431 +Ka 1.000000 1.000000 1.000000 +Kd 1 1 1 +Ks 0.500000 0.500000 0.500000 +Ke 0.000000 0.000000 0.000000 +Ni 1.000000 +d 1.000000 +illum 2 +map_Kd CubeImg.jpg + +newmtl CylMat +Ns 96.078431 +Ka 1.000000 1.000000 1.000000 +Kd 1 1 1 +Ks 0.500000 0.500000 0.500000 +Ke 0.000000 0.000000 0.000000 +Ni 1.000000 +d 1.000000 +illum 2 +map_Kd CylImg.jpg + +newmtl DoorMat +Ns 96.078431 +Ka 1.000000 1.000000 1.000000 +Kd 1 1 1 +Ks 0.500000 0.500000 0.500000 +Ke 0.000000 0.000000 0.000000 +Ni 1.000000 +d 1.000000 +illum 2 +map_Kd DoorImg.jpg diff --git a/examples/test-mesh-collider/models/test.obj b/examples/test-mesh-collider/models/test.obj new file mode 100644 index 0000000..b0ec03d --- /dev/null +++ b/examples/test-mesh-collider/models/test.obj @@ -0,0 +1,725 @@ +# Blender v2.77 (sub 0) OBJ File: 'test.blend' +# www.blender.org +mtllib test.mtl +o Door_Cube.001 +v 1.703071 2.322814 -0.792277 +v 3.090010 -0.354554 -0.383374 +v 1.396540 -0.946285 -0.383374 +v 1.396540 2.914545 -0.383374 +v 1.396540 2.914545 -0.792277 +v 1.396540 -0.946285 -0.792277 +v 3.396540 2.914545 -0.792277 +v 3.396540 -0.946285 -0.792277 +v 3.396540 2.914545 -0.383374 +v 3.396540 -0.946285 -0.383374 +v 1.703071 -0.354554 -0.383374 +v 3.090010 2.322814 -0.792277 +v 1.703071 2.322814 -0.383374 +v 1.703071 -0.354554 -0.792277 +v 3.090010 -0.354554 -0.792277 +v 3.090010 2.322814 -0.383374 +vt 0.7884 0.0160 +vt 0.7227 0.6326 +vt 0.7227 0.0160 +vt 0.8205 0.6326 +vt 0.8862 0.0160 +vt 0.8862 0.6326 +vt 0.0161 0.9840 +vt 0.0817 0.6646 +vt 0.0817 0.9840 +vt 0.1795 0.6646 +vt 0.1138 0.9840 +vt 0.1138 0.6646 +vt 0.6413 0.1105 +vt 0.6906 0.6326 +vt 0.6413 0.5381 +vt 0.0653 0.5381 +vt 0.0161 0.0160 +vt 0.0653 0.1105 +vt 0.3373 0.0160 +vt 0.2880 0.1105 +vt 0.3373 0.6326 +vt 0.2880 0.5381 +vt 0.0161 0.6326 +vt 0.4186 0.5381 +vt 0.3694 0.0160 +vt 0.4186 0.1105 +vt 0.6906 0.0160 +vt 0.3694 0.6326 +vt 0.2773 0.8861 +vt 0.2116 0.6646 +vt 0.2773 0.6646 +vt 0.3094 0.6646 +vt 0.3751 0.8861 +vt 0.3094 0.8861 +vt 0.9839 0.4756 +vt 0.9183 0.9032 +vt 0.9183 0.4756 +vt 0.9183 0.4436 +vt 0.9839 0.0160 +vt 0.9839 0.4436 +vt 0.7884 0.6326 +vt 0.8205 0.0160 +vt 0.0161 0.6646 +vt 0.1795 0.9840 +vt 0.2116 0.8861 +vt 0.3751 0.6646 +vt 0.9839 0.9032 +vt 0.9183 0.0160 +vn -1.0000 0.0000 0.0000 +vn 1.0000 0.0000 0.0000 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 0.0000 +vn 0.0000 0.0000 1.0000 +vn -0.0000 0.0000 -1.0000 +usemtl DoorMat +s off +f 5/1/1 3/2/1 4/3/1 +f 9/4/2 8/5/2 7/6/2 +f 6/7/3 10/8/3 3/9/3 +f 7/10/4 4/11/4 9/12/4 +f 13/13/5 3/14/5 11/15/5 +f 14/16/6 5/17/6 1/18/6 +f 1/18/6 7/19/6 12/20/6 +f 12/20/6 8/21/6 15/22/6 +f 15/22/6 6/23/6 14/16/6 +f 2/24/5 9/25/5 16/26/5 +f 16/26/5 4/27/5 13/13/5 +f 11/15/5 10/28/5 2/24/5 +f 14/29/4 2/30/4 15/31/4 +f 12/32/3 13/33/3 1/34/3 +f 14/35/2 13/36/2 11/37/2 +f 2/38/1 12/39/1 15/40/1 +f 5/1/1 6/41/1 3/2/1 +f 9/4/2 10/42/2 8/5/2 +f 6/7/3 8/43/3 10/8/3 +f 7/10/4 5/44/4 4/11/4 +f 13/13/5 4/27/5 3/14/5 +f 14/16/6 6/23/6 5/17/6 +f 1/18/6 5/17/6 7/19/6 +f 12/20/6 7/19/6 8/21/6 +f 15/22/6 8/21/6 6/23/6 +f 2/24/5 10/28/5 9/25/5 +f 16/26/5 9/25/5 4/27/5 +f 11/15/5 3/14/5 10/28/5 +f 14/29/4 11/45/4 2/30/4 +f 12/32/3 16/46/3 13/33/3 +f 14/35/2 1/47/2 13/36/2 +f 2/38/1 16/48/1 12/39/1 +o Cube +v 1.000000 -1.000000 -1.022902 +v 1.000000 -1.000000 0.977098 +v -1.000000 -1.000000 0.977098 +v -1.000000 -1.000000 -1.022903 +v 1.000000 1.000000 -1.022902 +v 0.999999 1.000000 0.977098 +v -1.000000 1.000000 0.977097 +v -1.000000 1.000000 -1.022902 +vt 0.0152 0.6818 +vt 0.3182 0.9848 +vt 0.0152 0.9848 +vt 0.6515 0.6515 +vt 0.3485 0.3485 +vt 0.6515 0.3485 +vt 0.3485 0.3182 +vt 0.6515 0.0152 +vt 0.6515 0.3182 +vt 0.0152 0.0152 +vt 0.3182 0.3182 +vt 0.0152 0.3182 +vt 0.3182 0.6515 +vt 0.0152 0.3485 +vt 0.3182 0.3485 +vt 0.9848 0.0152 +vt 0.6818 0.3182 +vt 0.6818 0.0152 +vt 0.3182 0.6818 +vt 0.3485 0.6515 +vt 0.3485 0.0152 +vt 0.3182 0.0152 +vt 0.0152 0.6515 +vt 0.9848 0.3182 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 0.0000 +vn 1.0000 -0.0000 0.0000 +vn -0.0000 -0.0000 1.0000 +vn -1.0000 -0.0000 -0.0000 +vn 0.0000 0.0000 -1.0000 +usemtl CubeMat +s off +f 17/49/7 19/50/7 20/51/7 +f 24/52/8 22/53/8 21/54/8 +f 21/55/9 18/56/9 17/57/9 +f 22/58/10 19/59/10 18/60/10 +f 19/61/11 24/62/11 20/63/11 +f 17/64/12 24/65/12 21/66/12 +f 17/49/7 18/67/7 19/50/7 +f 24/52/8 23/68/8 22/53/8 +f 21/55/9 22/69/9 18/56/9 +f 22/58/10 23/70/10 19/59/10 +f 19/61/11 23/71/11 24/62/11 +f 17/64/12 20/72/12 24/65/12 +o Cylinder +v 0.000000 0.389111 -2.467003 +v 0.000000 2.389111 -2.467003 +v 0.195090 0.389111 -2.447788 +v 0.195090 2.389111 -2.447788 +v 0.382683 0.389111 -2.390882 +v 0.382683 2.389111 -2.390882 +v 0.555570 0.389111 -2.298472 +v 0.555570 2.389111 -2.298472 +v 0.707107 0.389111 -2.174109 +v 0.707107 2.389111 -2.174109 +v 0.831470 0.389111 -2.022573 +v 0.831470 2.389111 -2.022573 +v 0.923880 0.389111 -1.849686 +v 0.923880 2.389111 -1.849686 +v 0.980785 0.389111 -1.662093 +v 0.980785 2.389111 -1.662093 +v 1.000000 0.389111 -1.467003 +v 1.000000 2.389111 -1.467003 +v 0.980785 0.389111 -1.271912 +v 0.980785 2.389111 -1.271912 +v 0.923880 0.389111 -1.084319 +v 0.923880 2.389111 -1.084319 +v 0.831470 0.389111 -0.911432 +v 0.831470 2.389111 -0.911432 +v 0.707107 0.389111 -0.759896 +v 0.707107 2.389111 -0.759896 +v 0.555570 0.389111 -0.635533 +v 0.555570 2.389111 -0.635533 +v 0.382683 0.389111 -0.543123 +v 0.382683 2.389111 -0.543123 +v 0.195090 0.389111 -0.486217 +v 0.195090 2.389111 -0.486217 +v -0.000000 0.389111 -0.467003 +v -0.000000 2.389111 -0.467003 +v -0.195091 0.389111 -0.486217 +v -0.195091 2.389111 -0.486217 +v -0.382684 0.389111 -0.543123 +v -0.382684 2.389111 -0.543123 +v -0.555571 0.389111 -0.635533 +v -0.555571 2.389111 -0.635533 +v -0.707107 0.389111 -0.759896 +v -0.707107 2.389111 -0.759896 +v -0.831470 0.389111 -0.911433 +v -0.831470 2.389111 -0.911433 +v -0.923880 0.389111 -1.084320 +v -0.923880 2.389111 -1.084320 +v -0.980785 0.389111 -1.271913 +v -0.980785 2.389111 -1.271913 +v -1.000000 0.389111 -1.467004 +v -1.000000 2.389111 -1.467004 +v -0.980785 0.389111 -1.662094 +v -0.980785 2.389111 -1.662094 +v -0.923879 0.389111 -1.849687 +v -0.923879 2.389111 -1.849687 +v -0.831469 0.389111 -2.022574 +v -0.831469 2.389111 -2.022574 +v -0.707106 0.389111 -2.174110 +v -0.707106 2.389111 -2.174110 +v -0.555569 0.389111 -2.298473 +v -0.555569 2.389111 -2.298473 +v -0.382682 0.389111 -2.390883 +v -0.382682 2.389111 -2.390883 +v -0.195089 0.389111 -2.447788 +v -0.195089 2.389111 -2.447788 +vt 0.6003 0.0152 +vt 0.6368 0.3191 +vt 0.6003 0.3191 +vt 0.6368 0.0152 +vt 0.6712 0.3191 +vt 0.6712 0.0152 +vt 0.7021 0.3191 +vt 0.7021 0.0152 +vt 0.7284 0.3191 +vt 0.7284 0.0152 +vt 0.7491 0.3191 +vt 0.7021 0.6534 +vt 0.6758 0.3495 +vt 0.7021 0.3495 +vt 0.6758 0.6534 +vt 0.6449 0.3495 +vt 0.6449 0.6534 +vt 0.6105 0.3495 +vt 0.6105 0.6534 +vt 0.5740 0.3495 +vt 0.5740 0.6534 +vt 0.5367 0.3495 +vt 0.5367 0.6534 +vt 0.5002 0.3495 +vt 0.5002 0.6534 +vt 0.4658 0.3495 +vt 0.4658 0.6534 +vt 0.4349 0.3495 +vt 0.7401 0.3495 +vt 0.7710 0.6534 +vt 0.7401 0.6534 +vt 0.7710 0.3495 +vt 0.8054 0.6534 +vt 0.8054 0.3495 +vt 0.8419 0.6534 +vt 0.8419 0.3495 +vt 0.8792 0.6534 +vt 0.8792 0.3495 +vt 0.9157 0.6534 +vt 0.9157 0.3495 +vt 0.9501 0.6534 +vt 0.9501 0.3495 +vt 0.9810 0.6534 +vt 0.0190 0.6809 +vt 0.0534 0.9848 +vt 0.0190 0.9848 +vt 0.0534 0.6809 +vt 0.0899 0.9848 +vt 0.0899 0.6809 +vt 0.1271 0.9848 +vt 0.1271 0.6809 +vt 0.1636 0.9848 +vt 0.1636 0.6809 +vt 0.1980 0.9848 +vt 0.1980 0.6809 +vt 0.2290 0.9848 +vt 0.2290 0.6809 +vt 0.2553 0.9848 +vt 0.4349 0.0152 +vt 0.4612 0.3191 +vt 0.4349 0.3191 +vt 0.4612 0.0152 +vt 0.4922 0.3191 +vt 0.4922 0.0152 +vt 0.5265 0.3191 +vt 0.0612 0.0700 +vt 0.3284 0.0490 +vt 0.0875 0.2839 +vt 0.5265 0.0152 +vt 0.5631 0.3191 +vt 0.5631 0.0152 +vt 0.3284 0.3818 +vt 0.3547 0.5957 +vt 0.0612 0.4029 +vt 0.7491 0.0152 +vt 0.4349 0.6534 +vt 0.9810 0.3495 +vt 0.2553 0.6809 +vt 0.3547 0.2628 +vt 0.3284 0.2839 +vt 0.2975 0.3004 +vt 0.2631 0.3118 +vt 0.2266 0.3176 +vt 0.1893 0.3176 +vt 0.1528 0.3118 +vt 0.1184 0.3004 +vt 0.0612 0.2628 +vt 0.0405 0.2381 +vt 0.0262 0.2105 +vt 0.0190 0.1813 +vt 0.0190 0.1515 +vt 0.0262 0.1223 +vt 0.0405 0.0948 +vt 0.0875 0.0490 +vt 0.1184 0.0324 +vt 0.1528 0.0210 +vt 0.1893 0.0152 +vt 0.2266 0.0152 +vt 0.2631 0.0210 +vt 0.2975 0.0324 +vt 0.3547 0.0700 +vt 0.3754 0.0948 +vt 0.3897 0.1223 +vt 0.3969 0.1515 +vt 0.3969 0.1813 +vt 0.3897 0.2105 +vt 0.3754 0.2381 +vt 0.0875 0.6167 +vt 0.0612 0.5957 +vt 0.0405 0.5709 +vt 0.0262 0.5434 +vt 0.0190 0.5142 +vt 0.0190 0.4844 +vt 0.0262 0.4552 +vt 0.0405 0.4276 +vt 0.0875 0.3818 +vt 0.1184 0.3653 +vt 0.1528 0.3539 +vt 0.1893 0.3480 +vt 0.2266 0.3480 +vt 0.2631 0.3539 +vt 0.2975 0.3653 +vt 0.3547 0.4029 +vt 0.3754 0.4276 +vt 0.3897 0.4552 +vt 0.3969 0.4844 +vt 0.3969 0.5142 +vt 0.3897 0.5434 +vt 0.3754 0.5709 +vt 0.3284 0.6167 +vt 0.2975 0.6333 +vt 0.2631 0.6447 +vt 0.2266 0.6505 +vt 0.1893 0.6505 +vt 0.1528 0.6447 +vt 0.1184 0.6333 +vn 0.0980 0.0000 -0.9952 +vn 0.2903 0.0000 -0.9569 +vn 0.4714 0.0000 -0.8819 +vn 0.6344 0.0000 -0.7730 +vn 0.7730 0.0000 -0.6344 +vn 0.8819 0.0000 -0.4714 +vn 0.9569 0.0000 -0.2903 +vn 0.9952 0.0000 -0.0980 +vn 0.9952 0.0000 0.0980 +vn 0.9569 0.0000 0.2903 +vn 0.8819 0.0000 0.4714 +vn 0.7730 0.0000 0.6344 +vn 0.6344 0.0000 0.7730 +vn 0.4714 0.0000 0.8819 +vn 0.2903 0.0000 0.9569 +vn 0.0980 0.0000 0.9952 +vn -0.0980 0.0000 0.9952 +vn -0.2903 0.0000 0.9569 +vn -0.4714 0.0000 0.8819 +vn -0.6344 0.0000 0.7730 +vn -0.7730 0.0000 0.6344 +vn -0.8819 0.0000 0.4714 +vn -0.9569 0.0000 0.2903 +vn -0.9952 0.0000 0.0980 +vn -0.9952 0.0000 -0.0980 +vn -0.9569 0.0000 -0.2903 +vn -0.8819 0.0000 -0.4714 +vn -0.7730 0.0000 -0.6344 +vn -0.6344 0.0000 -0.7730 +vn -0.4714 0.0000 -0.8819 +vn 0.0000 1.0000 0.0000 +vn -0.2903 0.0000 -0.9569 +vn -0.0980 0.0000 -0.9952 +vn 0.0000 -1.0000 0.0000 +usemtl CylMat +s off +f 26/73/13 27/74/13 25/75/13 +f 28/76/14 29/77/14 27/74/14 +f 30/78/15 31/79/15 29/77/15 +f 32/80/16 33/81/16 31/79/16 +f 34/82/17 35/83/17 33/81/17 +f 36/84/18 37/85/18 35/86/18 +f 38/87/19 39/88/19 37/85/19 +f 40/89/20 41/90/20 39/88/20 +f 42/91/21 43/92/21 41/90/21 +f 44/93/22 45/94/22 43/92/22 +f 46/95/23 47/96/23 45/94/23 +f 48/97/24 49/98/24 47/96/24 +f 50/99/25 51/100/25 49/98/25 +f 52/101/26 53/102/26 51/103/26 +f 54/104/27 55/105/27 53/102/27 +f 56/106/28 57/107/28 55/105/28 +f 58/108/29 59/109/29 57/107/29 +f 60/110/30 61/111/30 59/109/30 +f 62/112/31 63/113/31 61/111/31 +f 64/114/32 65/115/32 63/113/32 +f 66/116/33 67/117/33 65/118/33 +f 68/119/34 69/120/34 67/117/34 +f 70/121/35 71/122/35 69/120/35 +f 72/123/36 73/124/36 71/122/36 +f 74/125/37 75/126/37 73/124/37 +f 76/127/38 77/128/38 75/126/38 +f 78/129/39 79/130/39 77/128/39 +f 80/131/40 81/132/40 79/133/40 +f 82/134/41 83/135/41 81/132/41 +f 84/136/42 85/137/42 83/135/42 +f 62/138/43 46/139/43 78/140/43 +f 86/141/44 87/142/44 85/137/44 +f 88/143/45 25/75/45 87/142/45 +f 55/144/46 71/145/46 39/146/46 +f 26/73/13 28/76/13 27/74/13 +f 28/76/14 30/78/14 29/77/14 +f 30/78/15 32/80/15 31/79/15 +f 32/80/16 34/82/16 33/81/16 +f 34/82/17 36/147/17 35/83/17 +f 36/84/18 38/87/18 37/85/18 +f 38/87/19 40/89/19 39/88/19 +f 40/89/20 42/91/20 41/90/20 +f 42/91/21 44/93/21 43/92/21 +f 44/93/22 46/95/22 45/94/22 +f 46/95/23 48/97/23 47/96/23 +f 48/97/24 50/99/24 49/98/24 +f 50/99/25 52/148/25 51/100/25 +f 52/101/26 54/104/26 53/102/26 +f 54/104/27 56/106/27 55/105/27 +f 56/106/28 58/108/28 57/107/28 +f 58/108/29 60/110/29 59/109/29 +f 60/110/30 62/112/30 61/111/30 +f 62/112/31 64/114/31 63/113/31 +f 64/114/32 66/149/32 65/115/32 +f 66/116/33 68/119/33 67/117/33 +f 68/119/34 70/121/34 69/120/34 +f 70/121/35 72/123/35 71/122/35 +f 72/123/36 74/125/36 73/124/36 +f 74/125/37 76/127/37 75/126/37 +f 76/127/38 78/129/38 77/128/38 +f 78/129/39 80/150/39 79/130/39 +f 80/131/40 82/134/40 81/132/40 +f 82/134/41 84/136/41 83/135/41 +f 84/136/42 86/141/42 85/137/42 +f 30/151/43 28/152/43 26/153/43 +f 26/153/43 88/154/43 30/151/43 +f 86/155/43 84/156/43 82/157/43 +f 82/157/43 80/158/43 78/140/43 +f 78/140/43 76/159/43 74/160/43 +f 74/160/43 72/161/43 78/140/43 +f 70/162/43 68/163/43 62/138/43 +f 66/164/43 64/165/43 62/138/43 +f 62/138/43 60/166/43 58/167/43 +f 58/167/43 56/168/43 54/169/43 +f 54/169/43 52/170/43 50/171/43 +f 50/171/43 48/172/43 46/139/43 +f 46/139/43 44/173/43 42/174/43 +f 42/174/43 40/175/43 46/139/43 +f 38/176/43 36/177/43 34/178/43 +f 34/178/43 32/179/43 30/151/43 +f 30/151/43 88/154/43 86/155/43 +f 86/155/43 82/157/43 30/151/43 +f 78/140/43 72/161/43 70/162/43 +f 68/163/43 66/164/43 62/138/43 +f 62/138/43 58/167/43 46/139/43 +f 54/169/43 50/171/43 46/139/43 +f 46/139/43 40/175/43 38/176/43 +f 38/176/43 34/178/43 46/139/43 +f 30/151/43 82/157/43 78/140/43 +f 78/140/43 70/162/43 62/138/43 +f 58/167/43 54/169/43 46/139/43 +f 46/139/43 34/178/43 30/151/43 +f 30/151/43 78/140/43 46/139/43 +f 86/141/44 88/143/44 87/142/44 +f 88/143/45 26/73/45 25/75/45 +f 87/180/46 25/181/46 27/182/46 +f 27/182/46 29/183/46 31/184/46 +f 31/184/46 33/185/46 35/186/46 +f 35/186/46 37/187/46 31/184/46 +f 39/146/46 41/188/46 43/189/46 +f 43/189/46 45/190/46 39/146/46 +f 47/191/46 49/192/46 55/144/46 +f 51/193/46 53/194/46 55/144/46 +f 55/144/46 57/195/46 59/196/46 +f 59/196/46 61/197/46 63/198/46 +f 63/198/46 65/199/46 67/200/46 +f 67/200/46 69/201/46 71/145/46 +f 71/145/46 73/202/46 75/203/46 +f 75/203/46 77/204/46 79/205/46 +f 79/205/46 81/206/46 87/180/46 +f 83/207/46 85/208/46 87/180/46 +f 87/180/46 27/182/46 39/146/46 +f 31/184/46 37/187/46 39/146/46 +f 39/146/46 45/190/46 47/191/46 +f 49/192/46 51/193/46 55/144/46 +f 55/144/46 59/196/46 71/145/46 +f 63/198/46 67/200/46 71/145/46 +f 71/145/46 75/203/46 87/180/46 +f 81/206/46 83/207/46 87/180/46 +f 27/182/46 31/184/46 39/146/46 +f 39/146/46 47/191/46 55/144/46 +f 59/196/46 63/198/46 71/145/46 +f 75/203/46 79/205/46 87/180/46 +f 87/180/46 39/146/46 71/145/46 +o Cone +v 0.000000 2.027411 -1.252813 +v 0.195090 2.027411 -1.233598 +v 0.382683 2.027411 -1.176692 +v 0.555570 2.027411 -1.084282 +v 0.707107 2.027411 -0.959920 +v 0.831470 2.027411 -0.808383 +v 0.923880 2.027411 -0.635496 +v 0.980785 2.027411 -0.447903 +v 1.000000 2.027411 -0.252813 +v 0.000000 4.027411 -0.252813 +v 0.980785 2.027411 -0.057723 +v 0.923880 2.027411 0.129870 +v 0.831470 2.027411 0.302757 +v 0.707107 2.027411 0.454294 +v 0.555570 2.027411 0.578657 +v 0.382683 2.027411 0.671067 +v 0.195090 2.027411 0.727972 +v -0.000000 2.027411 0.747187 +v -0.195091 2.027411 0.727972 +v -0.382684 2.027411 0.671066 +v -0.555571 2.027411 0.578656 +v -0.707107 2.027411 0.454293 +v -0.831470 2.027411 0.302757 +v -0.923880 2.027411 0.129870 +v -0.980785 2.027411 -0.057723 +v -1.000000 2.027411 -0.252814 +v -0.980785 2.027411 -0.447904 +v -0.923879 2.027411 -0.635497 +v -0.831469 2.027411 -0.808384 +v -0.707106 2.027411 -0.959921 +v -0.555569 2.027411 -1.084283 +v -0.382682 2.027411 -1.176693 +v -0.195089 2.027411 -1.233598 +vt 0.4667 0.3864 +vt 0.7278 0.0207 +vt 0.4929 0.4082 +vt 0.5235 0.4283 +vt 0.5573 0.4457 +vt 0.5930 0.4599 +vt 0.6293 0.4704 +vt 0.6648 0.4766 +vt 0.6980 0.4785 +vt 0.7278 0.4758 +vt 0.0195 0.8362 +vt 0.2784 0.4734 +vt 0.0417 0.8574 +vt 0.0692 0.8773 +vt 0.1010 0.8950 +vt 0.1359 0.9099 +vt 0.1725 0.9215 +vt 0.2094 0.9293 +vt 0.2451 0.9329 +vt 0.2784 0.9323 +vt 0.7438 0.9038 +vt 0.9805 0.5198 +vt 0.7713 0.9236 +vt 0.8032 0.9414 +vt 0.8380 0.9563 +vt 0.8746 0.9679 +vt 0.9115 0.9757 +vt 0.9472 0.9793 +vt 0.9805 0.9787 +vt 0.7049 0.5204 +vt 0.7049 0.9793 +vt 0.6716 0.5198 +vt 0.6358 0.5235 +vt 0.5989 0.5313 +vt 0.5624 0.5428 +vt 0.5275 0.5578 +vt 0.4957 0.5755 +vt 0.4681 0.5954 +vt 0.4459 0.6166 +vt 0.4459 0.3636 +vt 0.3995 0.1664 +vt 0.2697 0.4242 +vt 0.1567 0.0286 +vt 0.0269 0.2864 +vt 0.0195 0.2466 +vt 0.0195 0.2061 +vt 0.0269 0.1664 +vt 0.0415 0.1289 +vt 0.0627 0.0952 +vt 0.0897 0.0666 +vt 0.1214 0.0441 +vt 0.1941 0.0207 +vt 0.2323 0.0207 +vt 0.2697 0.0286 +vt 0.3050 0.0441 +vt 0.3367 0.0666 +vt 0.3637 0.0952 +vt 0.3849 0.1289 +vt 0.4070 0.2061 +vt 0.4070 0.2466 +vt 0.3995 0.2864 +vt 0.3849 0.3238 +vt 0.3637 0.3575 +vt 0.3367 0.3862 +vt 0.3050 0.4087 +vt 0.2323 0.4321 +vt 0.1941 0.4321 +vt 0.1567 0.4242 +vt 0.1214 0.4087 +vt 0.0897 0.3862 +vt 0.0627 0.3575 +vt 0.0415 0.3238 +vn 0.0878 0.4455 -0.8910 +vn 0.2599 0.4455 -0.8567 +vn 0.4220 0.4455 -0.7896 +vn 0.5680 0.4455 -0.6921 +vn 0.6921 0.4455 -0.5680 +vn 0.7896 0.4455 -0.4220 +vn 0.8567 0.4455 -0.2599 +vn 0.8910 0.4455 -0.0878 +vn 0.8910 0.4455 0.0878 +vn 0.8567 0.4455 0.2599 +vn 0.7896 0.4455 0.4220 +vn 0.6921 0.4455 0.5680 +vn 0.5680 0.4455 0.6921 +vn 0.4220 0.4455 0.7896 +vn 0.2599 0.4455 0.8567 +vn 0.0878 0.4455 0.8910 +vn -0.0878 0.4455 0.8910 +vn -0.2599 0.4455 0.8567 +vn -0.4220 0.4455 0.7896 +vn -0.5680 0.4455 0.6921 +vn -0.6921 0.4455 0.5680 +vn -0.7896 0.4455 0.4220 +vn -0.8567 0.4455 0.2599 +vn -0.8910 0.4455 0.0878 +vn -0.8910 0.4455 -0.0878 +vn -0.8567 0.4455 -0.2599 +vn -0.7896 0.4455 -0.4220 +vn -0.6921 0.4455 -0.5680 +vn -0.5680 0.4455 -0.6921 +vn -0.4220 0.4455 -0.7896 +vn -0.2599 0.4455 -0.8567 +vn -0.0878 0.4455 -0.8910 +vn 0.0000 -1.0000 0.0000 +usemtl ConeMat +s off +f 89/209/47 98/210/47 90/211/47 +f 90/211/48 98/210/48 91/212/48 +f 91/212/49 98/210/49 92/213/49 +f 92/213/50 98/210/50 93/214/50 +f 93/214/51 98/210/51 94/215/51 +f 94/215/52 98/210/52 95/216/52 +f 95/216/53 98/210/53 96/217/53 +f 96/217/54 98/210/54 97/218/54 +f 97/219/55 98/220/55 99/221/55 +f 99/221/56 98/220/56 100/222/56 +f 100/222/57 98/220/57 101/223/57 +f 101/223/58 98/220/58 102/224/58 +f 102/224/59 98/220/59 103/225/59 +f 103/225/60 98/220/60 104/226/60 +f 104/226/61 98/220/61 105/227/61 +f 105/227/62 98/220/62 106/228/62 +f 106/229/63 98/230/63 107/231/63 +f 107/231/64 98/230/64 108/232/64 +f 108/232/65 98/230/65 109/233/65 +f 109/233/66 98/230/66 110/234/66 +f 110/234/67 98/230/67 111/235/67 +f 111/235/68 98/230/68 112/236/68 +f 112/236/69 98/230/69 113/237/69 +f 113/238/70 98/239/70 114/240/70 +f 114/240/71 98/239/71 115/241/71 +f 115/241/72 98/239/72 116/242/72 +f 116/242/73 98/239/73 117/243/73 +f 117/243/74 98/239/74 118/244/74 +f 118/244/75 98/239/75 119/245/75 +f 119/245/76 98/239/76 120/246/76 +f 120/246/77 98/239/77 121/247/77 +f 121/248/78 98/210/78 89/209/78 +f 105/249/79 113/250/79 96/251/79 +f 121/252/79 89/253/79 90/254/79 +f 90/254/79 91/255/79 92/256/79 +f 92/256/79 93/257/79 94/258/79 +f 94/258/79 95/259/79 92/256/79 +f 96/251/79 97/260/79 99/261/79 +f 99/261/79 100/262/79 96/251/79 +f 101/263/79 102/264/79 105/249/79 +f 103/265/79 104/266/79 105/249/79 +f 105/249/79 106/267/79 107/268/79 +f 107/268/79 108/269/79 109/270/79 +f 109/270/79 110/271/79 111/272/79 +f 111/272/79 112/273/79 113/250/79 +f 113/250/79 114/274/79 115/275/79 +f 115/275/79 116/276/79 117/277/79 +f 117/277/79 118/278/79 121/252/79 +f 119/279/79 120/280/79 121/252/79 +f 121/252/79 90/254/79 96/251/79 +f 92/256/79 95/259/79 96/251/79 +f 96/251/79 100/262/79 101/263/79 +f 102/264/79 103/265/79 105/249/79 +f 105/249/79 107/268/79 113/250/79 +f 109/270/79 111/272/79 113/250/79 +f 113/250/79 115/275/79 121/252/79 +f 118/278/79 119/279/79 121/252/79 +f 90/254/79 92/256/79 96/251/79 +f 96/251/79 101/263/79 105/249/79 +f 107/268/79 109/270/79 113/250/79 +f 115/275/79 117/277/79 121/252/79 +f 121/252/79 96/251/79 113/250/79 diff --git a/package.json b/package.json index 7083713..b266918 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aframe-altspace-component", - "version": "1.3.0", + "version": "1.3.1", "description": "aframe-altspace-component makes A-frame apps compatible with AltspaceVR.", "main": "src/index.js", "scripts": { diff --git a/src/native-components.js b/src/native-components.js index e96b862..c647604 100755 --- a/src/native-components.js +++ b/src/native-components.js @@ -7,6 +7,14 @@ * @namespace native */ (function () { + if (!window.altspace || !altspace.inClient) { + var noop = function () {}; + window.altspace = { + addNativeComponent: noop, + updateNativeComponent: noop, + removeNativeComponent: noop + }; + } var placeholderGeometry = new THREE.BoxGeometry(0.001, 0.001, 0.001); var placeholderMaterial = new THREE.MeshBasicMaterial({ color: 0x000000 }); @@ -17,16 +25,22 @@ PlaceholderMesh.prototype = Object.create( THREE.Mesh.prototype ); PlaceholderMesh.prototype.constructor = THREE.PlaceholderMesh; - function nativeComponentInit() { - var mesh = this.el.getOrCreateObject3D('mesh', PlaceholderMesh); - + function meshInit(mesh) { //If you attach native components to an entity, it will not use a default collider mesh.userData.altspace = mesh.userData.altspace || {}; mesh.userData.altspace.collider = mesh.userData.altspace.collider || {}; mesh.userData.altspace.collider.enabled = false; altspace.addNativeComponent(mesh, this.name); - this.update(this.data);//to pass defaults + } + + function nativeComponentInit() { + var mesh = this.el.getOrCreateObject3D('mesh', PlaceholderMesh); + + meshInit.call(this, mesh); + + //to pass defaults + this.update(this.data); } function nativeComponentRemove() { var mesh = this.el.getObject3D('mesh'); @@ -41,13 +55,13 @@ } /** - * Attach a given native object to this entity. - * @mixin n-object + * Attach a given native object to this entity. + * @mixin n-object * @memberof native - * @prop {string} res - The identifier for the resource you want. This component + * @prop {string} res - The identifier for the resource you want. This component * can accept all resources except for `interactables`. - * @example - */ + * @example + */ AFRAME.registerComponent('n-object', { schema: { res: {type: 'string'} @@ -58,15 +72,15 @@ }); /** - * Create an object that spawns additional copies of itself when grabbed by a user (the copies are not spawners themselves). + * Create an object that spawns additional copies of itself when grabbed by a user (the copies are not spawners themselves). * These copies will be physically interactive and automatically synchronized * between users. - * @mixin n-spawner + * @mixin n-spawner * @memberof native - * @prop {string} res - The identifier for the resource you want. This component + * @prop {string} res - The identifier for the resource you want. This component * can only accept resources of type `interactables`. - * @example - */ + * @example + */ AFRAME.registerComponent('n-spawner', { schema: { res: {type: 'string'} @@ -77,21 +91,21 @@ }); /** - * Creates dynamic 2D text on the entity. The text will wrap automatically based on the width and height provided. - * This text will be clearer than texture-based text and more performant than geometry-based test. - * @mixin n-text + * Creates dynamic 2D text on the entity. The text will wrap automatically based on the width and height provided. + * This text will be clearer than texture-based text and more performant than geometry-based test. + * @mixin n-text * @memberof native - * @prop {string} text - The text to be drawn. - * @prop {number} fontSize=10 - The height of the letters. 10pt ~= 1m - * @prop {number} width=10 - The width of the text area in meters. If the - * text is wider than this value, the overflow will be wrapped to the next line. - * @prop {number} height=1 - The height of the text area in meters. If the - * text is taller than this value, the overflow will be cut off. - * @prop {string} horizontalAlign=middle - The horizontal anchor point for - * the text. Can be `left`, `middle`, or `right`. - * @prop {string} verticalAlign=middle - The vertical anchor point for the - * text. Can be `top`, `middle`, or `bottom`. - */ + * @prop {string} text - The text to be drawn. + * @prop {number} fontSize=10 - The height of the letters. 10pt ~= 1m + * @prop {number} width=10 - The width of the text area in meters. If the + * text is wider than this value, the overflow will be wrapped to the next line. + * @prop {number} height=1 - The height of the text area in meters. If the + * text is taller than this value, the overflow will be cut off. + * @prop {string} horizontalAlign=middle - The horizontal anchor point for + * the text. Can be `left`, `middle`, or `right`. + * @prop {string} verticalAlign=middle - The vertical anchor point for the + * text. Can be `top`, `middle`, or `bottom`. + */ AFRAME.registerComponent('n-text', { init: nativeComponentInit, update: nativeComponentUpdate, @@ -125,7 +139,7 @@ * @name n-collider * @mixin n-collider * @memberof native - * @prop {vec3} center=0,0,0 - The offset of the collider in local space. + * @prop {vec3} center=0,0,0 - The offset of the collider in local space. * @prop {string} type=hologram - The type of collider, one of: `object` | `environment` | `hologram`. * Object colliders collide with other objects, the environment, and the cursor. * Environment colliders collide with everything objects do, but you can also @@ -133,13 +147,13 @@ * the cursor. */ - /** - * Create a spherical collider on this entity. - * @mixin n-sphere-collider + /** + * Create a spherical collider on this entity. + * @mixin n-sphere-collider * @memberof native * @extends native.n-collider - * @prop {number} radius=1 - The size of the collider in meters. - */ + * @prop {number} radius=1 - The size of the collider in meters. + */ AFRAME.registerComponent('n-sphere-collider', { init:nativeComponentInit, remove: nativeComponentRemove, @@ -154,12 +168,12 @@ /** - * Create a box-shaped collider on this entity. - * @mixin n-box-collider + * Create a box-shaped collider on this entity. + * @mixin n-box-collider * @memberof native * @extends native.n-collider - * @prop {vec3} size=1,1,1 - The dimensions of the collider. - */ + * @prop {vec3} size=1,1,1 - The dimensions of the collider. + */ AFRAME.registerComponent('n-box-collider', { init:nativeComponentInit, remove: nativeComponentRemove, @@ -173,16 +187,16 @@ }); /** - * Create a capsule-shaped collider on this entity. Capsules - * are a union of a cylinder and two spheres on top and bottom. - * @mixin n-capsule-collider + * Create a capsule-shaped collider on this entity. Capsules + * are a union of a cylinder and two spheres on top and bottom. + * @mixin n-capsule-collider * @memberof native * @extends native.n-collider - * @prop {number} radius=1 - The radius of the capsule in meters. - * @prop {number} height=1 - The height of the shaft of the capsule in meters. - * @prop {string} direction=y - The axis with which the capsule is aligned. - * One of `x`, `y`, or `z`. - */ + * @prop {number} radius=1 - The radius of the capsule in meters. + * @prop {number} height=1 - The height of the shaft of the capsule in meters. + * @prop {string} direction=y - The axis with which the capsule is aligned. + * One of `x`, `y`, or `z`. + */ AFRAME.registerComponent('n-capsule-collider', { init:nativeComponentInit, remove: nativeComponentRemove, @@ -198,17 +212,60 @@ }); /** - * Enable collision for the entire attached mesh. This is expensive to evaluate, so should only be used on - * low-poly meshes. - * @mixin n-mesh-collider + * Enable collision for the entire attached mesh. This is expensive to evaluate, so should only be used on + * low-poly meshes. + * @mixin n-mesh-collider * @memberof native * @extends native.n-collider - * @example - */ + * @example + * @prop {bool} convex=true - Whether the collider should be convex or concave. Set this to false if you have holes + * in your mesh. Convex colliders are limited to 255 triangles. Note: concave colliders can be significantly more + * expensive comparet to conves colliders. + */ AFRAME.registerComponent('n-mesh-collider', { - init:nativeComponentInit, - remove: nativeComponentRemove, - update: nativeComponentUpdate, + _forEachMesh: function (func) { + var obj = this.el.object3DMap.mesh; + if (!obj) { return; } + if (obj instanceof THREE.Mesh) { + func(obj); + } + obj.traverse(function (childObj) { + if (childObj instanceof THREE.Mesh) { + func(childObj); + } + }.bind(this)); + }, + _initObj: function () { + this._forEachMesh(function (mesh) { + meshInit.call(this, mesh); + + //to pass defaults + altspace.updateNativeComponent(mesh, this.name, this.data); + }.bind(this)); + }, + init: function () { + // Allow a-frame to create a PlaceholderMesh if there isn't already one, so that the native collider is + // registered. + this.el.getOrCreateObject3D('mesh', PlaceholderMesh); + + // Initialize the existing mesh + this._initObj(); + + this.el.addEventListener('model-loaded', function () { + // Re-initialize the collider if a new model is loaded + this._initObj(); + }.bind(this)); + }, + remove: function () { + this._forEachMesh(function (mesh) { + altspace.removeNativeComponent(mesh, this.name); + }.bind(this)); + }, + update: function (oldData) { + this._forEachMesh(function (mesh) { + altspace.updateNativeComponent(mesh, this.name, this.data); + }.bind(this)); + }, schema: { isTrigger: { default: false, type: 'boolean' }, convex: { default: true, type: 'boolean' }, @@ -217,26 +274,26 @@ }); /** - * Make the object's +Z always face the viewer. Currently will only directly apply to main mesh or native component on the attached entity, not any children or submeshes. - * @mixin n-billboard + * Make the object's +Z always face the viewer. Currently will only directly apply to main mesh or native component on the attached entity, not any children or submeshes. + * @mixin n-billboard * @memberof native - * @example - */ + * @example + */ AFRAME.registerComponent('n-billboard', { init:nativeComponentInit, remove: nativeComponentRemove, }); /** - * A container keeps a running tally of how many objects are within - * its bounds, and adds and removes the states `container-full` and + * A container keeps a running tally of how many objects are within + * its bounds, and adds and removes the states `container-full` and * `container-empty` based on the current count of objects. Can fire three * special events: `container-full`, `container-empty`, and `container-count-changed`. - * @mixin n-container + * @mixin n-container * @memberof native - * @prop {number} capacity=4 - The value at which the container will fire the - * `container-full` event. - */ + * @prop {number} capacity=4 - The value at which the container will fire the + * `container-full` event. + */ AFRAME.registerComponent('n-container', { init: function(){ nativeComponentInit.call(this); @@ -264,12 +321,12 @@ } }); - /** - * Play the sound given by the `src` or `res` property from the location + /** + * Play the sound given by the `src` or `res` property from the location * of the entity. - * @mixin n-sound + * @mixin n-sound * @memberof native - * @prop {string} res - The resource identifier for a built-in sound clip. + * @prop {string} res - The resource identifier for a built-in sound clip. * @prop {string} src - A URL to an external sound clip. The sound can be in WAV, OGG or MP3 format. However. only * WAV is supported on all platforms. MP3 is supported on Gear VR and OGG is supported on desktop. * @prop {string} on - The name of the event that will play this sound clip. @@ -292,7 +349,7 @@ * If rolloff is 'linear' or 'cosine', the sound will be silent at this distance. * @prop {string} rolloff='logarithmic' - Set this to 'linear' or 'cosine' if you want to cut sounds off at a * maxDistance. - */ + */ /** * Fired when a sound has loaded and is ready to be played * @event native.n-sound#n-sound-loaded