|
@@ -2,6 +2,7 @@ import { Quaternion } from '../../Maths/math';
|
|
|
import { WindowsMotionController } from '../../Gamepads/Controllers/windowsMotionController';
|
|
|
import { OculusTouchController } from '../../Gamepads/Controllers/oculusTouchController';
|
|
|
import { WebXRInput } from './webXRInput';
|
|
|
+import { ViveController } from '../../Gamepads/Controllers/viveController';
|
|
|
|
|
|
/**
|
|
|
* Loads a controller model and adds it as a child of the WebXRControllers grip when the controller is created
|
|
@@ -13,7 +14,19 @@ export class WebXRControllerModelLoader {
|
|
|
*/
|
|
|
constructor(input: WebXRInput) {
|
|
|
input.onControllerAddedObservable.add((c) => {
|
|
|
- if (c.inputSource.gamepad && c.inputSource.gamepad.id === "oculus-touch") {
|
|
|
+ if (c.inputSource.gamepad && c.inputSource.gamepad.id === "htc-vive") {
|
|
|
+ let controllerModel = new ViveController(c.inputSource.gamepad);
|
|
|
+ controllerModel.hand = c.inputSource.handedness;
|
|
|
+ controllerModel.isXR = true;
|
|
|
+ controllerModel.initControllerMesh(c.grip!.getScene(), (m) => {
|
|
|
+ m.isPickable = false;
|
|
|
+ m.getChildMeshes(false).forEach((m) => {
|
|
|
+ m.isPickable = false;
|
|
|
+ });
|
|
|
+ controllerModel.mesh!.parent = c.grip!;
|
|
|
+ controllerModel.mesh!.rotationQuaternion = Quaternion.FromEulerAngles(0, Math.PI, 0);
|
|
|
+ });
|
|
|
+ } else if (c.inputSource.gamepad && c.inputSource.gamepad.id === "oculus-touch") {
|
|
|
let controllerModel = new OculusTouchController(c.inputSource.gamepad);
|
|
|
controllerModel.hand = c.inputSource.handedness;
|
|
|
controllerModel.isXR = true;
|