|
@@ -1,18 +1,16 @@
|
|
import { Group } from '../../objects/Group.js';
|
|
import { Group } from '../../objects/Group.js';
|
|
|
|
|
|
-function WebXRController() {
|
|
|
|
|
|
+class WebXRController {
|
|
|
|
|
|
- this._targetRay = null;
|
|
|
|
- this._grip = null;
|
|
|
|
- this._hand = null;
|
|
|
|
|
|
+ constructor() {
|
|
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-Object.assign( WebXRController.prototype, {
|
|
|
|
|
|
+ this._targetRay = null;
|
|
|
|
+ this._grip = null;
|
|
|
|
+ this._hand = null;
|
|
|
|
|
|
- constructor: WebXRController,
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- getHandSpace: function () {
|
|
|
|
|
|
+ getHandSpace() {
|
|
|
|
|
|
if ( this._hand === null ) {
|
|
if ( this._hand === null ) {
|
|
|
|
|
|
@@ -27,9 +25,9 @@ Object.assign( WebXRController.prototype, {
|
|
|
|
|
|
return this._hand;
|
|
return this._hand;
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- getTargetRaySpace: function () {
|
|
|
|
|
|
+ getTargetRaySpace() {
|
|
|
|
|
|
if ( this._targetRay === null ) {
|
|
if ( this._targetRay === null ) {
|
|
|
|
|
|
@@ -41,9 +39,9 @@ Object.assign( WebXRController.prototype, {
|
|
|
|
|
|
return this._targetRay;
|
|
return this._targetRay;
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- getGripSpace: function () {
|
|
|
|
|
|
+ getGripSpace() {
|
|
|
|
|
|
if ( this._grip === null ) {
|
|
if ( this._grip === null ) {
|
|
|
|
|
|
@@ -55,9 +53,9 @@ Object.assign( WebXRController.prototype, {
|
|
|
|
|
|
return this._grip;
|
|
return this._grip;
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- dispatchEvent: function ( event ) {
|
|
|
|
|
|
+ dispatchEvent( event ) {
|
|
|
|
|
|
if ( this._targetRay !== null ) {
|
|
if ( this._targetRay !== null ) {
|
|
|
|
|
|
@@ -79,9 +77,9 @@ Object.assign( WebXRController.prototype, {
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- disconnect: function ( inputSource ) {
|
|
|
|
|
|
+ disconnect( inputSource ) {
|
|
|
|
|
|
this.dispatchEvent( { type: 'disconnected', data: inputSource } );
|
|
this.dispatchEvent( { type: 'disconnected', data: inputSource } );
|
|
|
|
|
|
@@ -105,9 +103,9 @@ Object.assign( WebXRController.prototype, {
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- update: function ( inputSource, frame, referenceSpace ) {
|
|
|
|
|
|
+ update( inputSource, frame, referenceSpace ) {
|
|
|
|
|
|
let inputPose = null;
|
|
let inputPose = null;
|
|
let gripPose = null;
|
|
let gripPose = null;
|
|
@@ -238,7 +236,7 @@ Object.assign( WebXRController.prototype, {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-} );
|
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
export { WebXRController };
|
|
export { WebXRController };
|