Skip to content

Commit

Permalink
Update three.js to fix matrix flags on object3d add/remove
Browse files Browse the repository at this point in the history
And fix an issue related to updating invisible objects

Co-authored-by: Dominick D'Aniello <[email protected]>
  • Loading branch information
johnshaughnessy and netpro2k committed Sep 13, 2022
1 parent 7df08a0 commit c53c2f1
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 21 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"screenfull": "^4.0.1",
"sdp-transform": "^2.14.1",
"semver": "^7.3.2",
"three": "github:mozillareality/three.js#d96f3cf69c7303db807cabaa2acba09d648e5e96",
"three": "github:mozillareality/three.js#c40ae76f114346b33616f72edf43b4eef26d338d",
"three-ammo": "github:mozillareality/three-ammo",
"three-mesh-bvh": "^0.3.7",
"three-pathfinding": "^1.1.0",
Expand Down
5 changes: 0 additions & 5 deletions src/bit-systems/camera-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,6 @@ function updateUI(world, camera) {
sndToggleLblObj.text = captureAudio ? "Sound ON" : "Sound OFF";
sndToggleLblObj.sync();
}

// TODO HACK hidden objects are still not having their matricies updated correctly
// Seems like a regression of #5421
// updateMatrices should be checking forceWorldUpdate instead of parent.childrenNeedMatrixWorldUpdate
snapMenuObj.childrenNeedMatrixWorldUpdate = true;
}

let snapPixels;
Expand Down
3 changes: 0 additions & 3 deletions src/bit-systems/media-loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ function add(world, child, parent) {
const parentObj = world.eid2obj.get(parent);
const childObj = world.eid2obj.get(child);
parentObj.add(childObj);

// TODO: Fix this in THREE.Object3D.add
childObj.matrixWorldNeedsUpdate = true;
}

function* loadMedia(world, eid) {
Expand Down
4 changes: 0 additions & 4 deletions src/bit-systems/video-menu-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ export function videoMenuSystem(world: HubsWorld, userinput: any) {
const menuObj = world.eid2obj.get(menu)!;
const videoObj = world.eid2obj.get(eid)!;
videoObj.add(menuObj);
// TODO: Fix add in threejs
// TODO remove should also reset matrixWorld to cachedMatrixWorld
menuObj.matrixWorldNeedsUpdate = true;
menuObj.childrenNeedMatrixWorldUpdate = true;
setCursorRaycastable(world, menu, true);
});

Expand Down
2 changes: 0 additions & 2 deletions src/bit-systems/video-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ function swapAudioType<T extends AudioObject3D>(
APP.audios.set(eid, newAudio);

audio.parent!.add(newAudio);
newAudio.matrixWorldNeedsUpdate = true; // TODO: Fix in threejs
audio.removeFromParent();

swapObject3DComponent(world, eid, newAudio);
Expand Down Expand Up @@ -116,7 +115,6 @@ export function videoSystem(world: HubsWorld, audioSystem: AudioSystem) {
}
const audio = world.eid2obj.get(makeAudioSourceEntity(world, video, audioSystem))!;
videoObj.add(audio);
audio.matrixWorldNeedsUpdate = true; // TODO: Fix in threejs
// Note in media-video we call updateMatrixWorld here to force PositionalAudio's updateMatrixWorld to run even
// if it has an invisible parent. We don't want to have invisible parents now.
});
Expand Down

0 comments on commit c53c2f1

Please sign in to comment.