<commit_before># Controls

**NOTE:** Parts of these controls components may be merged into A-Frame core in the future. See [aframevr/aframe#1248](https://github.com/aframevr/aframe/pull/1248).

Extensible movement/rotation/hotkey controls, with support for a variety of input devices.

- **universal-controls**: Manager for other controls, which can be used to decide which input device is used when multiple are available, and to set common acceleration/sensitivity across all controls.

## Usage

Basic:

```html
<a-entity camera universal-controls></a-entity>
```

Extend with custom controls:

```html
<a-entity camera
          universal-controls="movementControls: custom, gamepad;"
          custom-controls></a-entity>
```

To implement your custom controls, define a component and override one or more methods:

| Type     | Required | Method |
|----------|----------|--------|
| Rotation | Yes      | isRotationActive() : boolean |
| Rotation | No       | getRotationDelta(deltaMS : number) : THREE.Vector3 |
| Rotation | No       | getRotation() : THREE.Vector3 |
| Movement | Yes      | isVelocityActive() : boolean |
| Movement | No       | getVelocityDelta(deltaMS : number) : THREE.Vector3 |
| Movement | No       | getPositionDelta(deltaMS : number) : THREE.Vector3 |

Example:

```js
AFRAME.registerCompononent('custom-controls', {
  isVelocityActive: function () {
    return Math.random() < 0.25;
  },
  getPositionDelta: function () {
    return new THREE.Vector3(1, 0, 0);
  }
});
```

## Input devices:

- **checkpoint-controls**: Teleport or animate between checkpoints. See also: [checkpoint](/src/misc/checkpoint.js). Fires `navigation-start` and `navigation-end` events.
- **gamepad-controls**: Gamepad position + (optional) rotation controls.
- **hmd-controls**: HMD rotation / positional tracking controls.
- **keyboard-controls**: WASD+Arrow key movement controls, with improved support for ZQSD and Dvorak layouts.
- **mouse-controls**: Mouse + Pointerlock controls. *Non-VR / desktop only.*<commit_msg>Fix typo.<commit_after># Controls

**NOTE:** Parts of these controls components may be merged into A-Frame core in the future. See [aframevr/aframe#1248](https://github.com/aframevr/aframe/pull/1248).

Extensible movement/rotation/hotkey controls, with support for a variety of input devices.

- **universal-controls**: Manager for other controls, which can be used to decide which input device is used when multiple are available, and to set common acceleration/sensitivity across all controls.

## Usage

Basic:

```html
<a-entity camera universal-controls></a-entity>
```

Extend with custom controls:

```html
<a-entity camera
          universal-controls="movementControls: custom, gamepad;"
          custom-controls></a-entity>
```

To implement your custom controls, define a component and override one or more methods:

| Type     | Required | Method |
|----------|----------|--------|
| Rotation | Yes      | isRotationActive() : boolean |
| Rotation | No       | getRotationDelta(deltaMS : number) : THREE.Vector3 |
| Rotation | No       | getRotation() : THREE.Vector3 |
| Movement | Yes      | isVelocityActive() : boolean |
| Movement | No       | getVelocityDelta(deltaMS : number) : THREE.Vector3 |
| Movement | No       | getPositionDelta(deltaMS : number) : THREE.Vector3 |

Example:

```js
AFRAME.registerComponent('custom-controls', {
  isVelocityActive: function () {
    return Math.random() < 0.25;
  },
  getPositionDelta: function () {
    return new THREE.Vector3(1, 0, 0);
  }
});
```

## Input devices:

- **checkpoint-controls**: Teleport or animate between checkpoints. See also: [checkpoint](/src/misc/checkpoint.js). Fires `navigation-start` and `navigation-end` events.
- **gamepad-controls**: Gamepad position + (optional) rotation controls.
- **hmd-controls**: HMD rotation / positional tracking controls.
- **keyboard-controls**: WASD+Arrow key movement controls, with improved support for ZQSD and Dvorak layouts.
- **mouse-controls**: Mouse + Pointerlock controls. *Non-VR / desktop only.*
{'fraction_non_alphanumeric': 0.13768472906403942, 'fraction_numerical': 0.00935960591133005, 'mean_word_length': 3.79456906729634, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2845913', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1128, 'n_words': 364}