-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: janusweb action: commit revision: path_from: revision_from: 6584e90da85d24b80af8a177b33005ee4ef679ea: path_to: revision_to:
commit 6584e90da85d24b80af8a177b33005ee4ef679ea Author: James Baicoianu <james_github@baicoianu.com> Date: Thu Jan 26 05:18:01 2017 -0800 Fix for offset remoteplayer faces diff --git a/scripts/janusghost.js b/scripts/janusghost.js
--- a/scripts/janusghost.js +++ b/scripts/janusghost.js @@ -105,28 +105,30 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() { var objects = this.getGhostObjects(); if (headid && this.head) { var assetid = headid; - if (objects && objects[headid]) { - assetid = this.id + '_head_model'; - var asset = elation.engine.assets.get({ - assettype: 'model', - name: assetid, - src: objects[headid].src, - mtl: objects[headid].mtl + if (!this.face || this.face.janusid != assetid) { + if (objects && objects[headid]) { + assetid = this.id + '_head_model'; + var asset = elation.engine.assets.get({ + assettype: 'model', + name: assetid, + src: objects[headid].src, + mtl: objects[headid].mtl + }); + } + if (headpos) { + this.head.properties.position.copy(headpos); + } + + this.face = this.head.spawn('janusobject', null, { + janus: this.janus, + room: this.room, + janusid: assetid, + position: headpos.clone().negate(), + orientation: new THREE.Quaternion().setFromEuler(new THREE.Euler(0, Math.PI, 0)), + lighting: this.lighting, + cull_face: 'none' }); } - if (headpos) { - this.head.properties.position.copy(headpos); - } - - this.face = this.head.spawn('janusobject', null, { - janus: this.janus, - room: this.room, - janusid: assetid, - position: headpos.clone().negate(), - orientation: new THREE.Quaternion().setFromEuler(new THREE.Euler(0, Math.PI, 0)), - lighting: this.lighting, - cull_face: 'none' - }); //this.head.properties.position.copy(headpos); } } @@ -197,8 +199,8 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() { if (movedata.view_dir && movedata.up_dir) { if (this.head) { - ydir.fromArray(parser.getVectorValue(movedata.up_dir, [0,1,0])), - zdir.fromArray(parser.getVectorValue(movedata.view_dir, [0,0,1])), + ydir.fromArray(parser.getVectorValue(movedata.up_dir, [0,1,0])); + zdir.fromArray(parser.getVectorValue(movedata.view_dir, [0,0,1])); xdir.crossVectors(zdir, ydir); xdir.crossVectors(zdir, ydir).normalize(); @@ -207,15 +209,11 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() { matrix.makeBasis(xdir, ydir, zdir); this.head.properties.orientation.setFromRotationMatrix(matrix); if (movedata.head_pos && this.face) { - var headpos = this.face.properties.position; + var headpos = this.head.properties.position; + var facepos = this.face.properties.position; var newpos = parser.getVectorValue(movedata.head_pos); -/* - headpos.copy(this.properties.head_pos).negate(); - headpos.x += newpos[0]; - headpos.y += newpos[1]; - headpos.z += newpos[2]; -*/ headpos.fromArray(newpos); + facepos.fromArray([-newpos[0], -newpos[1], -newpos[2]]).sub(this.properties.head_pos); } } } diff --git a/scripts/janusweb.js b/scripts/janusweb.js
--- a/scripts/janusweb.js +++ b/scripts/janusweb.js @@ -574,7 +574,9 @@ elation.require(['janusweb.config', 'engine.things.generic','janusweb.remoteplay //console.log('movedata update', moveData); if (opts.first || this.sentUpdates == this.updateRate) { - moveData["avatar"] = "<FireBoxRoom><Assets><AssetObject id=^screen^ src=^http://bai.dev.supcrit.com/media/janusweb/assets/hoverscreen.obj^ mtl=^http://bai.dev.supcrit.com/media/janusweb/assets/hoverscreen.mtl^ atex0=^https://identicons.github.com/^ /></Assets><Room><Ghost id=^" + this.userId + "^ js_id=^105^ locked=^false^ onclick=^^ oncollision=^^ interp_time=^0.1^ pos=^0.632876 -1.204882 32.774837^ vel=^0 0 0^ accel=^0 0 0^ xdir=^1 0 0^ ydir=^0 1 0^ zdir=^0 0 1^ scale=^1 1 1^ col=^#ffffff^ lighting=^true^ visible=^true^ shader_id=^^ head_id=^screen^ head_pos=^0 1.4 0^ body_id=^^ anim_id=^^ anim_speed=^1^ eye_pos=^0 1.6 0^ eye_ipd=^0^ userid_pos=^0 0.5 0^ loop=^false^ gain=^1^ pitch=^1^ auto_play=^false^ cull_face=^back^ play_once=^false^ /></Room></FireBoxRoom>"; + // FIXME - don't hardcode this! + var head_pos = '0 1.4 0'; + moveData["avatar"] = "<FireBoxRoom><Assets><AssetObject id=^screen^ src=^http://bai.dev.supcrit.com/media/janusweb/assets/hoverscreen.obj^ mtl=^http://bai.dev.supcrit.com/media/janusweb/assets/hoverscreen.mtl^ atex0=^https://identicons.github.com/^ /></Assets><Room><Ghost id=^" + this.userId + "^ js_id=^105^ locked=^false^ onclick=^^ oncollision=^^ interp_time=^0.1^ pos=^0.632876 -1.204882 32.774837^ vel=^0 0 0^ accel=^0 0 0^ xdir=^1 0 0^ ydir=^0 1 0^ zdir=^0 0 1^ scale=^1 1 1^ col=^#ffffff^ lighting=^true^ visible=^true^ shader_id=^^ head_id=^screen^ head_pos=^" + head_pos + "^ body_id=^^ anim_id=^^ anim_speed=^1^ eye_pos=^0 1.6 0^ eye_ipd=^0^ userid_pos=^0 0.5 0^ loop=^false^ gain=^1^ pitch=^1^ auto_play=^false^ cull_face=^back^ play_once=^false^ /></Room></FireBoxRoom>"; this.sentUpdates = 0; } diff --git a/scripts/remoteplayer.js b/scripts/remoteplayer.js
--- a/scripts/remoteplayer.js +++ b/scripts/remoteplayer.js @@ -29,10 +29,10 @@ elation.component.add('engine.things.remoteplayer', function() { 'position': [0,0.6,-0.0] }); this.neck = this.torso.spawn('generic', this.properties.player_name + '_neck', { - 'position': [0,0.4,0] + 'position': [0,0.4,0], }); this.head = this.neck.spawn('generic', this.properties.player_name + '_head', { - 'position': [0,0,0], + 'position': [0,1.4,0], }); /* this.face = this.head.spawn('maskgenerator', this.properties.player_name + '_mask', {
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 19:02:45 2024