repo: janusweb action: commit revision: path_from: revision_from: b85b8657941ad1028e610ca2e4e0f34ffdfc5ac6: path_to: revision_to:
commit b85b8657941ad1028e610ca2e4e0f34ffdfc5ac6 Author: James BaicoianuDate: Tue Oct 9 14:38:22 2018 -0700 Visible self-avatar diff --git a/scripts/janusplayer.js b/scripts/janusplayer.js
--- a/scripts/janusplayer.js
+++ b/scripts/janusplayer.js
@@ -124,6 +124,14 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
elation.events.add(this.gazecaster, 'raycastleave', elation.bind(this, this.handleGazeLeave));
elation.events.add(this.gazecaster, 'raycastmove', elation.bind(this, this.handleGazeMove));
+ let avatar = this.getAvatarData();
+ if (avatar) {
+ this.ghost = this.createObject('ghost', {
+ ghost_id: this.getUsername(),
+ avatar_src: 'data:text/plain,' + avatar
+ });
+ }
+
this.updateCollider();
}
this.enable = function() {
@@ -257,6 +265,17 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
}
}
}
+
+ if (this.ghost) {
+ if (this.ghost.head) {
+ this.ghost.head.position.copy(this.head.position);
+ this.ghost.head.orientation.copy(this.head.orientation).multiply(this.neck.orientation);
+ }
+ if (this.ghost.body) {
+ this.ghost.body.position.copy(this.body.position);
+ this.ghost.body.orientation.copy(this.body.orientation);
+ }
+ }
})();
this.updateCursor = (function() {
var _tmpvec = new THREE.Vector3();
@@ -500,7 +519,16 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
}
this.setAvatar = function(avatar) {
this.avatarNeedsUpdate = true;
- return this.setSetting('avatar', avatar);
+ let setting = this.setSetting('avatar', avatar);
+
+ if (this.ghost) {
+ this.ghost.die();
+ }
+ this.ghost = this.createObject('ghost', {
+ ghost_src: avatar
+ });
+
+ return setting;
}
this.hasVoipData = function() {
return this.voipqueue && this.voipqueue.length > 0;
-----END OF PAGE-----