Skip to content
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

fix networked-hand-controls issues with aframe-v1.5.0 #451

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/components/networked-hand-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ AFRAME.registerComponent('networked-hand-controls', {
this.loader = new THREE.GLTFLoader();
this.loader.setCrossOrigin('anonymous');
const handmodelUrl = this.MODEL_BASE + this.MODEL_NAMES[this.data.handModelStyle + this.data.hand.charAt(0).toUpperCase() + this.data.hand.slice(1)];

this.loader.load(this.data.customHandModelURL || handmodelUrl, gltf => {
const newMesh = gltf.scene.children[0];
const handModelOrientation = this.data.hand === 'left' ? Math.PI / 2 : -Math.PI / 2;
Expand All @@ -212,13 +211,17 @@ AFRAME.registerComponent('networked-hand-controls', {
this.clips = gltf.animations;
this.clips.forEach((clip) => {
this.clipNameToClip[clip.name] = clip;
})
})

this.el.setObject3D(this.str.mesh, newMesh);

const handMaterial = newMesh.children[1].material;
handMaterial.color = new THREE.Color(this.data.color);
this.rendererSystem.applyColorCorrection(handMaterial.color);
const handColor = this.data.color;
newMesh.traverse(function (object) {
if (!object.isMesh) {
return;
}
object.material.color = new THREE.Color(handColor);
});
newMesh.position.set(0, 0, 0);
newMesh.rotation.set(0, 0, handModelOrientation);
});
Expand All @@ -243,8 +246,6 @@ AFRAME.registerComponent('networked-hand-controls', {
'valve-index-controls',
// some older models that it doesn't hurt to include:
'oculus-go-controls',
'gearvr-controls',
'daydream-controls',
'vive-focus-controls',
],

Expand Down