|
@@ -311,8 +311,6 @@ export class WebXRControllerPointerSelection implements IWebXRFeature {
|
|
// pointer up right after down, if disable on touch out
|
|
// pointer up right after down, if disable on touch out
|
|
if (this._options.disablePointerUpOnTouchOut) {
|
|
if (this._options.disablePointerUpOnTouchOut) {
|
|
this._scene.simulatePointerUp(controllerData.pick, { pointerId: controllerData.id });
|
|
this._scene.simulatePointerUp(controllerData.pick, { pointerId: controllerData.id });
|
|
- } else {
|
|
|
|
- this._scene.simulatePointerMove(controllerData.pick, { pointerId: controllerData.id });
|
|
|
|
}
|
|
}
|
|
discMesh.isVisible = false;
|
|
discMesh.isVisible = false;
|
|
} else {
|
|
} else {
|
|
@@ -333,6 +331,8 @@ export class WebXRControllerPointerSelection implements IWebXRFeature {
|
|
timer = 0;
|
|
timer = 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ this._scene.simulatePointerMove(controllerData.pick, { pointerId: controllerData.id });
|
|
|
|
+
|
|
oldPick = controllerData.pick;
|
|
oldPick = controllerData.pick;
|
|
});
|
|
});
|
|
xrController.onDisposeObservable.addOnce(() => {
|
|
xrController.onDisposeObservable.addOnce(() => {
|
|
@@ -375,8 +375,6 @@ export class WebXRControllerPointerSelection implements IWebXRFeature {
|
|
controllerData.selectionComponent = xrController.gamepadController.getMainComponent();
|
|
controllerData.selectionComponent = xrController.gamepadController.getMainComponent();
|
|
}
|
|
}
|
|
|
|
|
|
- let observer: Nullable<Observer<XRFrame>> = null;
|
|
|
|
-
|
|
|
|
controllerData.onFrameObserver = this._xrSessionManager.onXRFrameObservable.add(() => {
|
|
controllerData.onFrameObserver = this._xrSessionManager.onXRFrameObservable.add(() => {
|
|
if (controllerData.selectionComponent && controllerData.selectionComponent.pressed) {
|
|
if (controllerData.selectionComponent && controllerData.selectionComponent.pressed) {
|
|
(<StandardMaterial>controllerData.selectionMesh.material).emissiveColor = this.selectionMeshPickedColor;
|
|
(<StandardMaterial>controllerData.selectionMesh.material).emissiveColor = this.selectionMeshPickedColor;
|
|
@@ -385,6 +383,10 @@ export class WebXRControllerPointerSelection implements IWebXRFeature {
|
|
(<StandardMaterial>controllerData.selectionMesh.material).emissiveColor = this.selectionMeshDefaultColor;
|
|
(<StandardMaterial>controllerData.selectionMesh.material).emissiveColor = this.selectionMeshDefaultColor;
|
|
(<StandardMaterial>controllerData.laserPointer.material).emissiveColor = this.lasterPointerDefaultColor;
|
|
(<StandardMaterial>controllerData.laserPointer.material).emissiveColor = this.lasterPointerDefaultColor;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (controllerData.pick) {
|
|
|
|
+ this._scene.simulatePointerMove(controllerData.pick, { pointerId: controllerData.id });
|
|
|
|
+ }
|
|
});
|
|
});
|
|
|
|
|
|
controllerData.onButtonChangedObserver = controllerData.selectionComponent.onButtonStateChanged.add((component) => {
|
|
controllerData.onButtonChangedObserver = controllerData.selectionComponent.onButtonStateChanged.add((component) => {
|
|
@@ -393,13 +395,7 @@ export class WebXRControllerPointerSelection implements IWebXRFeature {
|
|
if (controllerData.pick) {
|
|
if (controllerData.pick) {
|
|
if (pressed) {
|
|
if (pressed) {
|
|
this._scene.simulatePointerDown(controllerData.pick, { pointerId: controllerData.id });
|
|
this._scene.simulatePointerDown(controllerData.pick, { pointerId: controllerData.id });
|
|
- observer = this._xrSessionManager.onXRFrameObservable.add(() => {
|
|
|
|
- if (controllerData.pick) {
|
|
|
|
- this._scene.simulatePointerMove(controllerData.pick, { pointerId: controllerData.id });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
} else {
|
|
} else {
|
|
- this._xrSessionManager.onXRFrameObservable.remove(observer);
|
|
|
|
this._scene.simulatePointerUp(controllerData.pick, { pointerId: controllerData.id });
|
|
this._scene.simulatePointerUp(controllerData.pick, { pointerId: controllerData.id });
|
|
}
|
|
}
|
|
}
|
|
}
|