├── .babelrc ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── dist ├── .gitkeep ├── super-hands.js └── super-hands.min.js ├── examples ├── assets │ ├── events.jpg │ ├── examples.css │ ├── hand-controls.jpg │ ├── locomotion.jpg │ ├── physics.jpg │ ├── portals.jpg │ └── sticky.jpg ├── build.js ├── events │ ├── demo-recording.json │ ├── grid.png │ └── index.html ├── index.html ├── main.js ├── mouse │ ├── demo-recording.json │ ├── index-mouse.html │ └── index.html ├── physics │ ├── colortransform.png │ ├── demo-laser.json │ ├── demo-recording.json │ ├── index-laser.html │ ├── index-mouse.html │ └── index.html ├── portals.html ├── sticky │ └── index.html ├── super-basic │ └── index.html └── touch-test │ └── index.html ├── getting-started.md ├── index.js ├── machinima_tests ├── .babelrc ├── __init.test.js ├── helpers.js ├── karma.conf.js ├── main.js ├── recordings │ ├── doublegrab.json │ ├── droptarget.json │ ├── hands-nostretch-badTwoHandedGrab.json │ ├── hands-twoHandedPass.json │ ├── hands-worldMover.json │ ├── hands-worldScalerShrinkGrow.json │ ├── handsRecording.json │ ├── laserhands.json │ ├── leftoverHover.json │ ├── loco-hands2.json │ ├── locomotor-worldScaleGrowShrink.json │ ├── multihover.json │ ├── nested-grab.json │ ├── physics-twoHandedTwist.json │ └── regrab.json ├── scenes │ ├── drop-targets.html │ ├── hands-laser.html │ ├── hands-nostretch.html │ ├── hands-raycaster.html │ ├── hands.html │ ├── locomotor.html │ ├── nested.html │ ├── overlapped.html │ ├── physics-worker.html │ ├── physics.html │ ├── progressive-hands.html │ └── progressive-laser.html └── super_hands │ └── super-hands-machinima.test.js ├── news.md ├── package-lock.json ├── package.json ├── reaction_components ├── clickable.js ├── drag-droppable.js ├── draggable.js ├── droppable.js ├── grabbable.js ├── hoverable.js ├── prototypes │ ├── buttons-proto.js │ └── physics-grab-proto.js └── stretchable.js ├── readme_files ├── peep-show-super-hans.gif ├── super-hands-api.png └── super-hands-demo.gif ├── systems └── super-hands-system.js └── tests ├── .babelrc ├── __init.test.js ├── helpers.js ├── karma.conf.js ├── reaction-components ├── clickable.test.js ├── draggable.test.js ├── droppable.test.js ├── grabbable.test.js ├── hoverable.test.js └── stretchable.test.js ├── super-hands-component ├── integration.test.js ├── super-hands-core.test.js └── super-hands-geh.test.js └── testDependencies.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "production": { 4 | "presets": ["minify"] 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | !reaction_components/node_modules/ 3 | npm-debug.log 4 | .Rhistory 5 | README.html 6 | .bashcommands 7 | firefox/ 8 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at william@datatitian.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Thanks for helping with `super-hands`! 2 | 3 | Two important things to know when contributing: 4 | 5 | 1. This package uses standard js style. Run `npm run lint` before 6 | creating a pull request to check your code. 7 | 2. This package is validated through [machinima testing](https://github.com/wmurphyrd/aframe-machinima-testing). 8 | In addition to the unit and integration tests (`npm run test`), 9 | `super-hands` pull requests need to pass all checks in the 10 | motion-capture based functional testing suite run by calling 11 | `npm run test:machinima` from the command line. 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 William Murphy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dist/.gitkeep: -------------------------------------------------------------------------------- 1 | `npm run dist` to generate browser files. 2 | -------------------------------------------------------------------------------- /examples/assets/events.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/c-frame/aframe-super-hands-component/868e8090a4e41366fbfe4878e19095927b872ef3/examples/assets/events.jpg -------------------------------------------------------------------------------- /examples/assets/examples.css: -------------------------------------------------------------------------------- 1 | #replayer-button { 2 | position: fixed; 3 | bottom: 10px; 4 | left: 50%; 5 | transform: translate(-50%, 0); 6 | padding: 5px; 7 | z-index: 100; 8 | } 9 | -------------------------------------------------------------------------------- /examples/assets/hand-controls.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/c-frame/aframe-super-hands-component/868e8090a4e41366fbfe4878e19095927b872ef3/examples/assets/hand-controls.jpg -------------------------------------------------------------------------------- /examples/assets/locomotion.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/c-frame/aframe-super-hands-component/868e8090a4e41366fbfe4878e19095927b872ef3/examples/assets/locomotion.jpg -------------------------------------------------------------------------------- /examples/assets/physics.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/c-frame/aframe-super-hands-component/868e8090a4e41366fbfe4878e19095927b872ef3/examples/assets/physics.jpg -------------------------------------------------------------------------------- /examples/assets/portals.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/c-frame/aframe-super-hands-component/868e8090a4e41366fbfe4878e19095927b872ef3/examples/assets/portals.jpg -------------------------------------------------------------------------------- /examples/assets/sticky.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/c-frame/aframe-super-hands-component/868e8090a4e41366fbfe4878e19095927b872ef3/examples/assets/sticky.jpg -------------------------------------------------------------------------------- /examples/events/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/c-frame/aframe-super-hands-component/868e8090a4e41366fbfe4878e19095927b872ef3/examples/events/grid.png -------------------------------------------------------------------------------- /examples/events/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Super Hands Component - GlobalEventHandler Integration 4 | 6 | 7 | 8 | 9 | 10 | 11 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 47 | 48 | 49 | 50 | 52 | 53 | 54 | 55 | 60 | 63 | 64 | 70 | 71 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 61 | 62 | 63 | 64 |

A-Frame Super Hands Component

65 |

This is the examples page for the 66 | 67 | super-hands A-Frame component package 68 | 69 | for super-easy hand controller interactivity in A-Frame WebVR experiences. 70 |

71 | Hand controls 72 | with physics
73 | 74 | 75 |
76 |

Mouse cursor based version for desktop

77 |

82 |

Example of super-hands interactivity with roomscale tracked controllers 83 | and aframe-physics-system. Also showcases creating a simple 84 | custom reaction component.

85 |
 86 |     AFRAME.registerComponent('color-randomizer', {
 87 |       play: function() {
 88 |         this.el.addEventListener('drag-drop', function(evt) {
 89 |           evt.detail.dropped.setAttribute('material', 'color',
 90 |             '#'+(Math.random()*0xFFFFFF<<0).toString(16))
 91 |            // notify super-hands that the gesture was accepted
 92 |           evt.preventDefault()
 93 |         })
 94 |       }
 95 |     })
 96 |     
97 |

Credit for random color generator code: Mohsen via StackOverflow

98 | 99 | Gaze and laser pointer controls without physics 100 |
101 | 102 | 103 |
104 |

Mouse cursor based version for desktop

105 |

111 |

super-hands can also be use with other types of input 112 | including 3DOF controllers, mouse, and touch. In these cases, a 113 | raycasting can be used intead of collision detection. 114 | The confugration below works with the A-Frame raycaster 115 | component. 116 |

117 | super-hands="colliderEvent: raycaster-intersection;
118 |              colliderEventProperty: els;
119 |              colliderEndEvent: raycaster-intersection-cleared;
120 |              colliderEndEventProperty: clearedEls"
121 |

This scene also shows the fallback movement that occurs when physics 122 | is not available.

123 |

Quick guide to adding making something grabbable with physics on your site

124 |
125 | 134 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /examples/main.js: -------------------------------------------------------------------------------- 1 | require('aframe') 2 | require('../index.js') 3 | // require('aframe-motion-capture-components') 4 | /* used in examples to allow a desktop playback without HMD 5 | defined here to keep example files clear of clutter */ 6 | window.playDemoRecording = function (spectate) { 7 | const l = document.querySelector('a-link, a-entity[link]') 8 | const s = document.querySelector('a-scene') 9 | const b = document.getElementById('replayer-button') 10 | b && b.setAttribute('visible', 'false') 11 | l && l.setAttribute('visible', 'false') 12 | s.addEventListener('replayingstopped', e => { 13 | const c = document.querySelector('[camera]') 14 | window.setTimeout(function () { 15 | c.setAttribute('position', '0 1.6 2') 16 | c.setAttribute('rotation', '0 0 0') 17 | }) 18 | }) 19 | s.setAttribute('avatar-replayer', { 20 | src: './demo-recording.json', 21 | spectatorMode: spectate === undefined ? true : spectate, 22 | spectatorPosition: { x: 0, y: 1.6, z: 2 } 23 | }) 24 | } 25 | -------------------------------------------------------------------------------- /examples/mouse/index-mouse.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Super Hands Component - Pointer Controls 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 26 | 27 | 28 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /examples/mouse/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Super Hands Component - Pointer Controls 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 19 | 20 | 21 | 26 | 27 | 31 | 32 | 35 | 36 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /examples/physics/index-mouse.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Super Hands Component - 6DOF With Physics 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 46 | 47 | 48 | 49 | 50 | 51 | 56 | 57 | 58 | 66 | 67 | 74 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /examples/physics/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Super Hands Component - 6DOF With Physics 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 37 | 38 | 39 | 40 | 43 | 44 | 45 | 46 | 47 | 52 | 57 | 65 | 66 | 67 | 68 | 69 | 71 | 72 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 84 | 85 | 86 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /examples/portals.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Super Hands Component - Examples Home 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 34 | 40 | 41 | 47 | 48 | 49 | 55 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /examples/sticky/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Super Hands Component - Sticky Grab 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 26 | 29 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /examples/super-basic/index.html: -------------------------------------------------------------------------------- 1 | 2 | Most Basic Super-Hands Example 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/touch-test/index.html: -------------------------------------------------------------------------------- 1 | 2 | Most Basic Super-Hands Example 3 | 4 | 5 | 6 | 7 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /getting-started.md: -------------------------------------------------------------------------------- 1 | There are many ways this library can be used, but many use cases likely can be thought of as a variation off of the ability to pick something up with your controller in 6d0f VR. Here we walk through one possible very quick way to approach adding this ability to your existing application--one suggestion for one scenario. You can riff widely off this concept as needed. 2 | 3 | 1. Add Libraries: 4 | 5 | ```html 6 | 7 | 8 | 9 | 10 | ``` 11 | 12 | 2. Add Physics: 13 | 14 | Add the `physics` component to your scene 15 | _note: trying `physics="gravity: 0"` can sometimes help with debugging some issues, try at your own risk._ 16 | ```html 17 | `` 18 | ``` 19 | 20 | 3. Add Mixins 21 | 22 | Add these mixins within your ``. 23 | ```html 24 | 30 | 31 | 37 | 38 | 47 | ``` 48 | 49 | 50 | 4. Prevent hands from knocking things away before you grab them 51 | 52 | Add the following component to your project: 53 | ```js 54 | AFRAME.registerComponent('phase-shift', { 55 | init: function () { 56 | var el = this.el 57 | el.addEventListener('gripdown', function () { 58 | el.setAttribute('collision-filter', {collisionForces: true}) 59 | }) 60 | el.addEventListener('gripup', function () { 61 | el.setAttribute('collision-filter', {collisionForces: false}) 62 | }) 63 | } 64 | }); 65 | ``` 66 | 67 | 5. Give hands the ability to grab 68 | 69 | Add the `physics-hands` mixin to your hand entities 70 | ```html 71 | 73 | 74 | 76 | 77 | ``` 78 | 79 | 6. Make a floor things won't fall through 80 | 81 | Add `static-body` component to your ground and whatever surfaces you want to be able to put things on 82 | ```html 83 | 84 | 85 | 86 | 87 | ``` 88 | 89 | 7. Make your thing able to be picked up 90 | 91 | Add the mixin 'all-interactions' (or 'grab-move' if you don't want it to be 'stretchable') to whatever object you want to be able to reach into and pick up. 92 | ```html 93 | 94 | ``` 95 | 96 | -------------------------------------------------------------------------------- /machinima_tests/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [["env", { 3 | "targets": { 4 | "browsers": [ 5 | "last 1 Samsung versions", "last 2 Firefox versions", 6 | "last 2 Chrome versions", "last 2 FirefoxAndroid versions", 7 | "last 2 iOS versions" 8 | ] 9 | } 10 | }]], 11 | "env": { 12 | "production": { 13 | "presets": ["minify"] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /machinima_tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | const machinima = require('aframe-machinima-testing') 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true 7 | 8 | setup(function () { 9 | this.sinon = sinon.sandbox.create() 10 | }) 11 | 12 | teardown(function () { 13 | machinima.teardownReplayer() 14 | // Clean up any attached elements. 15 | const attachedEls = ['canvas', 'a-assets', 'a-scene'] 16 | const els = document.querySelectorAll(attachedEls.join(',')) 17 | 18 | for (let i = 0; i < els.length; i++) { 19 | els[i].parentNode.removeChild(els[i]) 20 | } 21 | this.sinon.restore() 22 | }) 23 | -------------------------------------------------------------------------------- /machinima_tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts, usePhysics) { 10 | const scene = document.createElement('a-scene') 11 | const assets = document.createElement('a-assets') 12 | const entity = document.createElement('a-entity') 13 | scene.appendChild(assets) 14 | scene.appendChild(entity) 15 | if (usePhysics) { scene.setAttribute('physics', '') } 16 | opts = opts || {} 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset) 21 | }) 22 | } 23 | 24 | document.body.appendChild(scene) 25 | // convenience link to scene because new entities in FF don't get .sceneEl until loaded 26 | entity.sceneEl = scene 27 | return entity 28 | } 29 | 30 | /** 31 | * Creates and attaches a mixin element (and an `` element if necessary). 32 | * 33 | * @param {string} id - ID of mixin. 34 | * @param {object} obj - Map of component names to attribute values. 35 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 36 | * @returns {object} An attached `` element. 37 | */ 38 | module.exports.mixinFactory = function (id, obj, scene) { 39 | const mixinEl = document.createElement('a-mixin') 40 | mixinEl.setAttribute('id', id) 41 | Object.keys(obj).forEach(function (componentName) { 42 | mixinEl.setAttribute(componentName, obj[componentName]) 43 | }) 44 | 45 | const assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets') 46 | assetsEl.appendChild(mixinEl) 47 | 48 | return mixinEl 49 | } 50 | 51 | /** 52 | * Test that is only run locally and is skipped on CI. 53 | */ 54 | module.exports.getSkipCISuite = function () { 55 | if (window.__env__.TEST_ENV === 'ci') { 56 | return suite.skip 57 | } else { 58 | return suite 59 | } 60 | } 61 | 62 | /** 63 | * Creates and attaches a hand controller entity with a control component 64 | * 65 | * @param {object} comps - Map of component names to attribute values. 66 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 67 | * @returns {bool} controllerOverride - Set true if comps already contains a controller component and does not need the default added. 68 | */ 69 | module.exports.controllerFactory = function (comps, controllerOverride, scene) { 70 | const contrEl = document.createElement('a-entity') 71 | comps = comps || {} 72 | if (!controllerOverride) { 73 | comps['vive-controls'] = 'hand: right' 74 | } 75 | Object.keys(comps).forEach(function (componentName) { 76 | contrEl.setAttribute(componentName, comps[componentName]) 77 | }) 78 | scene = scene || document.querySelector('a-scene') 79 | scene.appendChild(contrEl) 80 | return contrEl 81 | } 82 | -------------------------------------------------------------------------------- /machinima_tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // karma configuration 2 | const karmaConf = { 3 | browserify: { 4 | debug: true, 5 | transform: [ 6 | ['babelify'] 7 | ] 8 | }, 9 | browsers: ['Firefox_NoVR', 'Chrome'], 10 | // machinima: prevent timeout during recording playback 11 | browserNoActivityTimeout: 600000, 12 | client: { 13 | captureConsole: false, 14 | mocha: { ui: 'tdd' } 15 | }, 16 | customLaunchers: { 17 | Firefox_NoVR: { 18 | base: 'Firefox', 19 | prefs: { 20 | 'dom.vr.enabled': false 21 | } 22 | } 23 | }, 24 | files: [ 25 | // module and dependencies 26 | { pattern: 'main.js', included: true }, 27 | // test files. 28 | { pattern: './**/*.test.js' }, 29 | // HTML machinima scenes (pre-processed by html2js) 30 | { pattern: 'scenes/*.html' }, 31 | // machinima recording files (served at base/recordings/) 32 | { pattern: 'recordings/*.json', included: false, served: true } 33 | ], 34 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 35 | preprocessors: { 36 | 'main.js': ['browserify'], 37 | './**/*.js': ['browserify'], 38 | // process machinima scene files into window.__html__ array 39 | 'scenes/*.html': ['html2js'] 40 | }, 41 | reporters: ['mocha'], 42 | // machinima: make scene html available 43 | html2JsPreprocessor: { 44 | stripPrefix: 'scenes/' 45 | } 46 | } 47 | 48 | // Apply configuration 49 | module.exports = function (config) { 50 | config.set(karmaConf) 51 | } 52 | -------------------------------------------------------------------------------- /machinima_tests/main.js: -------------------------------------------------------------------------------- 1 | window.debug = true 2 | require('aframe') 3 | require('aframe-physics-system') 4 | require('aframe-extras') 5 | require('aframe-event-set-component') 6 | require('aframe-motion-capture-components') 7 | require('../index.js') 8 | -------------------------------------------------------------------------------- /machinima_tests/scenes/drop-targets.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /machinima_tests/scenes/hands-laser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 18 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |