HTML:
<a-entity camera
universal-controls="movementControls: custom, gamepad, keyboard">
</a-entity>
JS:
AFRAME.registerComponent('custom-controls', {
init: function () {
this.isMoving = false;
this.velocityDelta = new THREE.Vector3();
},
isVelocityActive: function () {
return this.isMoving;
},
getVelocityDelta: function () {
this.velocityDelta.z = this.isMoving ? -1 : 0;
return this.velocityDelta.clone();
}
});