-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media tools followup fixes #463
Conversation
…into media-tools-followup
resolution and gets loading indicators
…into media-tools-followup
package.json
Outdated
@@ -41,7 +41,7 @@ | |||
"jsonschema": "^1.2.2", | |||
"moving-average": "^1.0.0", | |||
"naf-janus-adapter": "^0.10.1", | |||
"networked-aframe": "https://github.com/mozillareality/networked-aframe#mr-social-client/master", | |||
"networked-aframe": "https://github.com/mozillareality/networked-aframe#bug/aframe-initialization-race-condition", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we point back to networked-aframe/master or pull in the latest to the dev fork and keep pointing at that? It got updated with our PR's last week.
src/components/cursor-controller.js
Outdated
@@ -97,6 +98,11 @@ AFRAME.registerComponent("cursor-controller", { | |||
if (this.data.drawLine) { | |||
this.el.setAttribute("line", { start: this.origin.clone(), end: this.data.cursor.object3D.position.clone() }); | |||
} | |||
|
|||
// The curser will always be oriented towards the player about its Y axis, so bjects held by the cursor will rotate towards the player. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typos:
// The curser cursor will always be oriented towards the player about its Y axis, so bjects objects held by the cursor will rotate towards the player.
@@ -202,6 +203,7 @@ function cachedLoadGLTF(src, preferredTechnique, onProgress) { | |||
AFRAME.registerComponent("gltf-model-plus", { | |||
schema: { | |||
src: { type: "string" }, | |||
basePath: { type: "string", default: undefined }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If basePath is not specified, nothing checks for that case and ultimately will wind up with an error being thrown in THREE.GLTFLoader
in cachedLoadGLTF()
. There should probably be a check to catch that case prior to undefined being passed into THREE.GLTFLoader
.
// Load the gltf model from the cache if it exists. | ||
if (!GLTFCache[src]) { | ||
GLTFCache[src] = new Promise((resolve, reject) => { | ||
const gltfLoader = new THREE.GLTFLoader(); | ||
gltfLoader.path = basePath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment on basePath
below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the intent here is that setting undefined is the same as not setting it. GLTFLoader doesnt require a path to be set.
src/components/image-plus.js
Outdated
@@ -180,6 +144,7 @@ AFRAME.registerComponent("image-plus", { | |||
texture.minFilter = THREE.LinearFilter; | |||
videoEl.addEventListener("loadedmetadata", () => resolve(texture), { once: true }); | |||
videoEl.onerror = reject; | |||
texture.audioSource = this.el.sceneEl.audioListener.context.createMediaElementSource(videoEl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't attach arbitrary objects to existing three.js constructs. If you need to associate the audioSource with a texture you should create a map in this component.
src/components/image-plus.js
Outdated
this.el.setObject3D("mesh", this.mesh); | ||
this.el.setAttribute("shape", { | ||
shape: "box", | ||
halfExtents: { x: width / 2, y: height / 2, z: 0.05 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.05
should probably be defined in component schema
src/components/image-plus.js
Outdated
halfExtents: { x: width / 2, y: height / 2, z: 0.05 } | ||
}); | ||
if (this.el.components.body && this.el.components.body.body) { | ||
this.el.components.body.syncToPhysics(); // not sure if necessary? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem like it should be necessary, but verify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have already tested it a bunch with this in, going to leave it in for now to avoid missing some edge case. Put in a todo to evaluate though.
src/components/super-spawner.js
Outdated
this.el.sceneEl.appendChild(entity); | ||
onGrabEnd(e) { | ||
this.heldEntities.delete(e.detail.hand); | ||
// This tells super-hands we are handling this releae |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// This tells super-hands we are handling this releae release
/** | ||
* Source of the media asset the spawner will spawn when grabbed. This can be a gltf, video, or image, or a url that the reticiulm media API can resolve to a gltf, video, or image. | ||
*/ | ||
src: { default: "https://asset-bundles-prod.reticulum.io/interactables/Ducky/DuckyMesh-438ff8e022.gltf" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having this defined here as the default seems wrong- this should get moved into the environment component data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, the plan would be to update the enviornments after we push this, then we can remove this default. This is just to allow us to push without breaking the existing environments during out push.
src/hub.html
Outdated
> | ||
<a-entity class="delete-button" visible-while-frozen> | ||
<a-entity class="delete-button" visible-while-frozen scale="1.00 1.00 1.00"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't scale 1 1 1
by default?
@@ -0,0 +1,20 @@ | |||
export function getBox(entity, boxRoot) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cache rotation and copy instead of clone
export function getBox() {
const rotation = new THEE.Quaternion();
return function (entity, boxRoot) {
...
rotation.copy(entity.object3D.rotation);
...
@@ -1,3 +1,5 @@ | |||
import { getBox } from "../utils/auto-box-collider.js"; | |||
|
|||
const PI = Math.PI; | |||
const HALF_PI = PI / 2; | |||
const THREE_HALF_PI = 3 * PI / 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const THREE_HALF_PI = 3 * HALF_PI;
this.mesh = this.el.getObject3D("mesh"); | ||
if (this.el.components.shape) { | ||
this.shape = this.el.components.shape; | ||
this.halfExtents = new THREE.Vector3().copy(this.shape.data.halfExtents); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cache this vector3
This PR addresses a bunch of the fixes outlined in #451, namely:
It would probably have been wise to break this up, but most of these were small fixes. The large majority of the work centered around unifying spawners, adding loading indicator, and fixing bounding boxes. Many underlying bugs and race conditions were discovered in aframe-physics-system and super-hands in the process, many of which exist in production today, but just didn't manifest in very noticeable ways.
There is some additional code cleanup that is probably warranted (particularly position-at-box-shape), though this is in a sufficiently better state than what is in production now that it feels silly to continue holding it back for those.