Skip to content

Commit

Permalink
Rename oculus-touch-controls to meta-touch-controls. Keep the old nam…
Browse files Browse the repository at this point in the history
…e for backwards compatibility
  • Loading branch information
dmarcos committed Nov 8, 2024
1 parent 43ab4b9 commit d3be3d2
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
---
title: oculus-touch-controls
title: meta-touch-controls
type: components
layout: docs
parent_section: components
source_code: src/components/oculus-touch-controls.js
source_code: src/components/meta-touch-controls.js
examples: []
---

[trackedcontrols]: ./tracked-controls.md

The oculus-touch-controls component interfaces with the Oculus Touch controllers (Rift, Rift S, Oculus Quest 1 and 2). It
The meta-touch-controls (formerly oculus-touch-controls) component interfaces with the Meta Touch controllers (Rift, Rift S, Oculus Quest 1, 2, 3 and 3s). It
wraps the [tracked-controls component][trackedcontrols] while adding button
mappings, events, and a Touch controller model.

## Example

```html
<a-entity oculus-touch-controls="hand: left"></a-entity>
<a-entity oculus-touch-controls="hand: right"></a-entity>
<a-entity meta-touch-controls="hand: left"></a-entity>
<a-entity meta-touch-controls="hand: right"></a-entity>
```

## Value
Expand Down Expand Up @@ -78,8 +78,8 @@ mappings, events, and a Touch controller model.
Listen to the `thumbstick` event and the values are available in the object passed to the handler

```html
<a-entity oculus-touch-controls="hand: left" thumbstick-logging></a-entity>
<a-entity oculus-touch-controls="hand: right" thumbstick-logging></a-entity>
<a-entity meta-touch-controls="hand: left" thumbstick-logging></a-entity>
<a-entity meta-touch-controls="hand: right" thumbstick-logging></a-entity>
```

```javascript
Expand Down
4 changes: 2 additions & 2 deletions examples/performance/in-vr/components/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AFRAME.registerComponent('controller', {
// Track all types of controllers.
el.setAttribute('daydream-controls', {hand: data.hand, model: false});
el.setAttribute('gearvr-controls', {hand: data.hand, model: false});
el.setAttribute('oculus-touch-controls', {hand: data.hand, model: false});
el.setAttribute('meta-touch-controls', {hand: data.hand, model: false});
el.setAttribute('vive-controls', {hand: data.hand, model: false});

// Wait for controller to connect before adding raycaster.
Expand Down Expand Up @@ -43,7 +43,7 @@ AFRAME.registerComponent('controller', {
cursor: {downEvents: ['trackpaddown'], upEvents: ['trackpadup']}
},

'oculus-touch-controls': {
'meta-touch-controls': {
cursor: {downEvents: ['triggerdown'], upEvents: ['triggerup']}
},

Expand Down
4 changes: 2 additions & 2 deletions examples/showcase/comicbook/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
</a-assets>
<a-entity
layer="src: #page1; height: 3; width: 1.9505"></a-entity>
<a-entity oculus-touch-controls="hand: left" page-controls></a-entity>
<a-entity oculus-touch-controls="hand: right" page-controls></a-entity>
<a-entity meta-touch-controls="hand: left" page-controls></a-entity>
<a-entity meta-touch-controls="hand: right" page-controls></a-entity>
</a-scene>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ AFRAME.registerComponent('link-controls', {
}
}
},
'oculus-touch-controls': {
'meta-touch-controls': {
left: {
xbutton: {
tooltip: 'text: Press X to peek link; width: 0.1; height: 0.04; targetPosition: 0.01 0.05 0',
Expand Down Expand Up @@ -188,7 +188,7 @@ AFRAME.registerComponent('link-controls', {
el.addEventListener('trackpadtouchstart', this.startPeeking);
el.addEventListener('trackpadtouchend', this.stopPeeking);
break;
case 'oculus-touch-controls':
case 'meta-touch-controls':
el.addEventListener('xbuttondown', this.startPeeking);
el.addEventListener('xbuttonup', this.stopPeeking);
el.addEventListener('abuttondown', this.startPeeking);
Expand All @@ -214,7 +214,7 @@ AFRAME.registerComponent('link-controls', {
el.removeEventListeners('trackpadtouchstart', this.startPeeking);
el.removeEventListeners('trackpadtouchend', this.stopPeeking);
break;
case 'oculus-touch-controls':
case 'meta-touch-controls':
el.removeEventListener('xbuttondown', this.startPeeking);
el.removeEventListener('xbuttonup', this.stopPeeking);
el.removeEventListener('abuttondown', this.startPeeking);
Expand Down
4 changes: 2 additions & 2 deletions examples/showcase/painter/components/brush.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ AFRAME.registerComponent('brush', {
this.onControllerConnected = this.onControllerConnected.bind(this);
el.addEventListener('controllerconnected', this.onControllerConnected);

this.el.setAttribute('oculus-touch-controls', {hand: this.data.hand});
this.el.setAttribute('meta-touch-controls', {hand: this.data.hand});
this.el.setAttribute('logitech-mx-ink-controls', {hand: this.data.hand});
},

Expand Down Expand Up @@ -96,7 +96,7 @@ AFRAME.registerComponent('brush', {
var pointerPosition = new THREE.Vector3();
var pointerOffset = new THREE.Vector3();
var controllerOffset = {
'oculus-touch-controls': {
'meta-touch-controls': {
left: new THREE.Vector3(0, -0.025, -0.04),
right: new THREE.Vector3(0, -0.025, -0.04)
},
Expand Down
6 changes: 3 additions & 3 deletions src/components/hand-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ EVENTS[ANIMATIONS.point] = 'pointing';

/**
* Hand controls component that abstracts 6DoF controls:
* oculus-touch-controls, vive-controls, windows-motion-controls.
* meta-touch-controls, vive-controls, windows-motion-controls.
*
* Originally meant to be a sample implementation of applications-specific controls that
* abstracts multiple types of controllers.
Expand Down Expand Up @@ -126,7 +126,7 @@ module.exports.Component = registerComponent('hand-controls', {

// Pico4, at least on Wolvic, needs a different rotation offset
// for the hand model. Pico Browser claims to use oculus
// controllers instead; will load oculus-touch-controls and does
// controllers instead; will load meta-touch-controls and does
// not require this adjustment.
if (evt.detail.name === 'pico-controls') {
handModelOrientationX += Math.PI / 4;
Expand Down Expand Up @@ -228,7 +228,7 @@ module.exports.Component = registerComponent('hand-controls', {
});
el.setAttribute('magicleap-controls', controlConfiguration);
el.setAttribute('vive-controls', controlConfiguration);
el.setAttribute('oculus-touch-controls', controlConfiguration);
el.setAttribute('meta-touch-controls', controlConfiguration);
el.setAttribute('pico-controls', controlConfiguration);
el.setAttribute('windows-motion-controls', controlConfiguration);
el.setAttribute('hp-mixed-reality-controls', controlConfiguration);
Expand Down
2 changes: 1 addition & 1 deletion src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require('./material');
require('./obb-collider');
require('./obj-model');
require('./oculus-go-controls');
require('./oculus-touch-controls');
require('./meta-touch-controls');
require('./pico-controls');
require('./position');
require('./raycaster');
Expand Down
7 changes: 6 additions & 1 deletion src/components/laser-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ registerComponent('laser-controls', {
el.setAttribute('hp-mixed-reality-controls', controlsConfiguration);
el.setAttribute('magicleap-controls', controlsConfiguration);
el.setAttribute('oculus-go-controls', controlsConfiguration);
el.setAttribute('oculus-touch-controls', controlsConfiguration);
el.setAttribute('meta-touch-controls', controlsConfiguration);
el.setAttribute('pico-controls', controlsConfiguration);
el.setAttribute('valve-index-controls', controlsConfiguration);
el.setAttribute('vive-controls', controlsConfiguration);
Expand Down Expand Up @@ -98,6 +98,11 @@ registerComponent('laser-controls', {
raycaster: {origin: {x: 0, y: 0, z: 0}}
},

'meta-touch-controls': {
cursor: {downEvents: ['triggerdown'], upEvents: ['triggerup']},
raycaster: {origin: {x: 0, y: 0, z: 0}}
},

'pico-controls': {
cursor: {downEvents: ['triggerdown'], upEvents: ['triggerup']}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ var INPUT_MAPPING = {
};

/**
* Oculus Touch controls.
* Interface with Oculus Touch controllers and map Gamepad events to
* Meta Touch controls (formerly Oculus Touch)
* Interface with Meta Touch controllers and map Gamepad events to
* controller buttons: thumbstick, trigger, grip, xbutton, ybutton, surface
* Load a controller model and highlight the pressed buttons.
*/
module.exports.Component = registerComponent('oculus-touch-controls', {
var componentConfig = {
schema: {
hand: {default: 'left'},
buttonColor: {type: 'color', default: '#999'}, // Off-white.
Expand Down Expand Up @@ -474,7 +474,10 @@ module.exports.Component = registerComponent('oculus-touch-controls', {
button.material.color.set(color);
}
}
});
};

registerComponent('oculus-touch-controls', componentConfig);
module.exports.Component = registerComponent('meta-touch-controls', componentConfig);

/**
* Some of the controller models share the same material for different parts (buttons, triggers...).
Expand Down
8 changes: 4 additions & 4 deletions tests/components/laser-controls.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ suite('laser-controls', function () {
suite('init', function () {
test('injects controllers', function () {
assert.ok(el.components['oculus-go-controls']);
assert.ok(el.components['oculus-touch-controls']);
assert.ok(el.components['meta-touch-controls']);
assert.ok(el.components['vive-controls']);
assert.ok(el.components['vive-focus-controls']);
assert.ok(el.components['windows-motion-controls']);
Expand All @@ -39,12 +39,12 @@ suite('laser-controls', function () {
});
});

test('configures raycaster for oculus-touch-controls', function (done) {
el.emit('controllerconnected', {name: 'oculus-go-controls'});
test('configures raycaster for meta-touch-controls', function (done) {
el.emit('controllerconnected', {name: 'meta-touch-controls'});
setTimeout(() => {
var raycaster = el.getAttribute('raycaster');
assert.equal(raycaster.origin.x, 0);
assert.equal(raycaster.origin.y, 0.0005);
assert.equal(raycaster.origin.y, 0);
done();
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* global assert, process, setup, sinon, suite, test */
var entityFactory = require('../helpers').entityFactory;

suite('oculus-touch-controls', function () {
suite('meta-touch-controls', function () {
var el;
var component;

setup(function (done) {
el = this.el = entityFactory();
el.setAttribute('oculus-touch-controls', '');
el.setAttribute('meta-touch-controls', '');
var callback = function () {
component = el.components['oculus-touch-controls'];
component = el.components['meta-touch-controls'];
// Initially no controllers are present
component.controllers = [];
// Our Mock data for enabling the controllers.
Expand All @@ -31,7 +31,7 @@ suite('oculus-touch-controls', function () {
var removeEventListenersSpy;

setup(function (done) {
component = this.el.components['oculus-touch-controls'];
component = this.el.components['meta-touch-controls'];
controllerSystem = this.el.sceneEl.systems['tracked-controls'];
controllerSystem.vrDisplay = true;
addEventListenersSpy = sinon.spy(component, 'addEventListeners');
Expand Down

0 comments on commit d3be3d2

Please sign in to comment.