Skip to content

Commit

Permalink
Pin to Three.js 161, before VR controller API change
Browse files Browse the repository at this point in the history
  • Loading branch information
DePasqualeOrg committed Sep 27, 2024
1 parent 58b3d6d commit e5bc772
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions build/three-immersive-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ var VRControls = class {
line.scale.z = 5;
return new Promise((resolve) => {
const controller = this.controls.renderer.xr.getController(i);
controller.addEventListener("added", (e) => {
controller.addEventListener("connected", (e) => {
const controllerGrip = this.controls.renderer.xr.getControllerGrip(i);
if (this.showControllerModel === true) {
controllerGrip.add(this.controllerModelFactory.createControllerModel(controllerGrip));
Expand All @@ -613,13 +613,13 @@ var VRControls = class {
console.error("Error assigning controller to right or left hand");
}
this.controls.player.add(controllerGrip, controller);
controller.gamepad = e.target.gamepad;
controller.gamepad = e.data.gamepad;
} else {
console.error("No XR session found");
}
resolve();
});
controller.addEventListener("removed", () => {
controller.addEventListener("disconnected", () => {
console.debug(`Controller ${i} disconnected`);
});
});
Expand Down
4 changes: 2 additions & 2 deletions examples/boilerplate/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r169/build/three.module.js",
"three/": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r169/",
"three": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r161/build/three.module.js",
"three/": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r161/",
"@depasquale/three-immersive-controls": "../../build/three-immersive-controls.js",
"@depasquale/three-stats-mesh": "https://unpkg.com/@depasquale/three-stats-mesh",
"@tweenjs/tween.js": "https://cdn.jsdelivr.net/gh/tweenjs/tween.js@v23.1.3/dist/tween.esm.js"
Expand Down
4 changes: 2 additions & 2 deletions examples/color-spaces/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r169/build/three.module.js",
"three/": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r169/",
"three": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r161/build/three.module.js",
"three/": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r161/",
"@depasquale/three-wizard": "https://unpkg.com/@depasquale/three-wizard",
"@depasquale/three-immersive-controls": "../../build/three-immersive-controls.js",
"@depasquale/three-stats-mesh": "https://unpkg.com/@depasquale/three-stats-mesh",
Expand Down
4 changes: 2 additions & 2 deletions examples/interactive-objects/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r169/build/three.module.js",
"three/": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r169/",
"three": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r161/build/three.module.js",
"three/": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r161/",
"@depasquale/three-wizard": "https://unpkg.com/@depasquale/three-wizard",
"@depasquale/three-immersive-controls": "../../build/three-immersive-controls.js",
"@depasquale/three-stats-mesh": "https://unpkg.com/@depasquale/three-stats-mesh",
Expand Down
4 changes: 2 additions & 2 deletions examples/morphing-loops/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r169/build/three.module.js",
"three/": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r169/",
"three": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r161/build/three.module.js",
"three/": "https://cdn.jsdelivr.net/gh/mrdoob/three.js@r161/",
"@depasquale/three-wizard": "https://unpkg.com/@depasquale/three-wizard",
"@depasquale/three-immersive-controls": "../../build/three-immersive-controls.js",
"@depasquale/three-stats-mesh": "https://unpkg.com/@depasquale/three-stats-mesh",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"@depasquale/three-stats-mesh": "^0.0.15",
"@depasquale/three-wizard": "^0.0.14",
"@tweenjs/tween.js": "23.0.0",
"three": "^0.169.0"
"three": "0.161.0"
},
"devDependencies": {
"@depasquale/eslint-config-typescript": "^0.0.15",
"@depasquale/front-end-build-tools": "^0.0.3",
"@types/three": "^0.169.0",
"@types/three": "0.161.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"bulma": "^1.0.2",
Expand Down
6 changes: 3 additions & 3 deletions src/ts/modules/controls/VRControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ class VRControls {

return new Promise<void>((resolve) => {
const controller = this.controls.renderer.xr.getController(i) as unknown as Controller; // Surface with buttons, thumbstick
controller.addEventListener('added', (e) => {
controller.addEventListener('connected', (e) => {
const controllerGrip = this.controls.renderer.xr.getControllerGrip(i); // The part held in the hand
if (this.showControllerModel === true) {
controllerGrip.add(this.controllerModelFactory.createControllerModel(controllerGrip));
Expand All @@ -507,13 +507,13 @@ class VRControls {
console.error('Error assigning controller to right or left hand');
}
this.controls.player.add(controllerGrip, controller);
controller.gamepad = e.target.gamepad;
controller.gamepad = e.data.gamepad;
} else {
console.error('No XR session found');
}
resolve();
});
controller.addEventListener('removed', () => {
controller.addEventListener('disconnected', () => {
console.debug(`Controller ${i} disconnected`);
// !! Need to figure out a solution here (see above)
});
Expand Down

0 comments on commit e5bc772

Please sign in to comment.