elation-engine 0.9.120 → 0.9.122

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elation-engine",
3
3
  "description": "WebGL/WebVR engine written in Javascript",
4
- "version": "0.9.120",
4
+ "version": "0.9.122",
5
5
  "main": "",
6
6
  "author": "James Baicoianu",
7
7
  "license": "MIT",
package/scripts/assets.js CHANGED
@@ -1528,6 +1528,9 @@ console.log('set up hls', hlsConfig);
1528
1528
  if (n.geometry && !n.geometry.attributes.normal) {
1529
1529
  n.geometry.computeVertexNormals();
1530
1530
  }
1531
+ if (n.name.match(/^mixamorig:/)) {
1532
+ n.name = n.name.replace('mixamorig:', '');
1533
+ }
1531
1534
  });
1532
1535
 
1533
1536
  if (modeldata.userData && modeldata.userData.gltfExtensions && modeldata.userData.gltfExtensions.VRM) {
@@ -739,6 +739,13 @@ console.log('skelly data', boneDatas);
739
739
 
740
740
  //console.log('found a part to clone!', oldname, parts[0], src, dst, track.name);
741
741
  found = true;
742
+ } else if (parts[0].indexOf(':') > -1) {
743
+ let parts2 = parts[0].split(':');
744
+ if (parts2[1] == src.name || parts[1] == src.uuid) {
745
+ parts[0] = dst.name || dst.uuid;
746
+ track.name = parts.join('.');
747
+ found = true;
748
+ }
742
749
  }
743
750
  });
744
751
  if (!found) {
@@ -45194,7 +45194,7 @@
45194
45194
  }
45195
45195
 
45196
45196
  // Characters [].:/ are reserved for track binding syntax.
45197
- const _RESERVED_CHARS_RE = '\\[\\]\\.:\\/';
45197
+ const _RESERVED_CHARS_RE = '\\[\\]\\.\\/';
45198
45198
  const _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );
45199
45199
 
45200
45200
  // Attempts to allow node names from any language. ES5's `\w` regexp matches
@@ -210,7 +210,7 @@ elation.require(['ui.window', 'ui.panel', 'ui.toggle', 'ui.slider', 'ui.label',
210
210
  if (!this.container) this.container = (this.engine.systems.render ? this.engine.systems.render.renderer.domElement : window);
211
211
  elation.events.add(this.container, "mousedown,mousemove,mouseup,mousewheel,click,DOMMouseScroll,gesturestart,gesturechange,gestureend", this);
212
212
  //elation.events.add(this.container, "touchstart,touchmove,touchend, this);
213
- elation.events.add(window, "keydown,keyup,webkitGamepadConnected,webkitgamepaddisconnected,MozGamepadConnected,MozGamepadDisconnected,gamepadconnected,gamepaddisconnected", this);
213
+ elation.events.add(window, "keydown,keyup,webkitGamepadConnected,webkitgamepaddisconnected,MozGamepadConnected,MozGamepadDisconnected,gamepadconnected,gamepaddisconnected,focus", this);
214
214
  //elation.events.add(window, "deviceorientation,devicemotion", this);
215
215
  elation.events.add(document, "pointerlockchange,webkitpointerlockchange,mozpointerlockchange", elation.bind(this, this.pointerLockChange));
216
216
  elation.events.add(document, "pointerlockerror,webkitpointerlockerror,mozpointerlockerror", elation.bind(this, this.pointerLockError));
@@ -810,6 +810,7 @@ elation.require(['ui.window', 'ui.panel', 'ui.toggle', 'ui.slider', 'ui.label',
810
810
  this.state[bindid] = 0;
811
811
  this.changes.push(bindid);
812
812
  }, 10);
813
+ ev.preventDefault();
813
814
  }
814
815
  this.keydown = function(ev) {
815
816
  // Send key events for both keyboard_<key> and keyboard_<modname>_<key>
@@ -1000,6 +1001,9 @@ return;
1000
1001
  this.capturekeys.splice(idx, 1);
1001
1002
  }
1002
1003
  }
1004
+ this.focus = function(ev) {
1005
+ if (this.state['keyboard_alt']) this.state['keyboard_alt'] = 0; // fix sticky alt key on alt tab
1006
+ }
1003
1007
  });
1004
1008
  if (0) {
1005
1009
  elation.component.add('engine.systems.controls.config', function() {
@@ -21,13 +21,13 @@ elation.require(["physics.cyclone"], function() {
21
21
  this.engine_start = function(ev) {
22
22
  //console.log("PHYSICS: starting");
23
23
  this.system.start({subprocessor: 'cpu', processorargs: { path: 'https://baicoianu.com/~bai/janusweb/build/1.5.32/media/lib/physx/'}});
24
- this.lasttime = new Date().getTime();
24
+ this.lasttime = performance.now();
25
25
  if (this.interval) {
26
26
  clearInterval(this.interval);
27
27
  }
28
28
  if (this.async) {
29
29
  this.interval = setInterval(elation.bind(this, function() {
30
- var now = new Date().getTime();
30
+ var now = performance.now();
31
31
  //this.system.step(this.timescale * (now - this.lasttime) / 1000);
32
32
  //if (this.stats) this.stats.update();
33
33
  this.step((now - this.lasttime) / 1000);
@@ -242,6 +242,9 @@ elation.component.add("engine.things.generic", function() {
242
242
  configurable: true,
243
243
  enumerable: true,
244
244
  get: function() {
245
+ if ('get' in prop) {
246
+ return prop.get.call(this);
247
+ }
245
248
  var proxy = this._proxies[propname];
246
249
  if (proxy) {
247
250
  return proxy;
@@ -25,6 +25,7 @@ elation.require(['engine.things.generic', 'engine.things.camera', 'engine.things
25
25
  dynamicfriction:{ type: 'float', default: 2.0, comment: 'Dynamic friction inherent to this object' },
26
26
  staticfriction: { type: 'float', default: 1.9, comment: 'Static friction inherent to this object' },
27
27
  fov: { type: 'float', default: 75, set: this.updateCamera },
28
+ turnhead: { type: 'boolean', default: false, set: this.updateHeadLock },
28
29
  });
29
30
  this.controlstate = this.engine.systems.controls.addContext('player', {
30
31
  'move_forward': ['keyboard_w', elation.bind(this, this.updateControls)],
@@ -182,6 +183,7 @@ elation.require(['engine.things.generic', 'engine.things.camera', 'engine.things
182
183
  this.createChildren = function() {
183
184
  // place camera at head height
184
185
  this.headconstraint = this.head.objects.dynamics.addConstraint('axis', { axis: new THREE.Vector3(1,0,0), min: -Math.PI/2, max: Math.PI/2 });
186
+ this.neckconstraint = this.neck.objects.dynamics.addConstraint('axis', { axis: new THREE.Vector3(0,1,0), min: 3/4 * -Math.PI/2, max: 3/4 * Math.PI/2 });
185
187
  this.reset_position();
186
188
  }
187
189
  this.createForces = function() {
@@ -220,7 +222,7 @@ elation.require(['engine.things.generic', 'engine.things.camera', 'engine.things
220
222
  'position': [0,1.45,0]
221
223
  });
222
224
  this.head = this.neck.spawn('generic', this.properties.player_id + '_head', {
223
- 'position': [0,.3,0],
225
+ 'position': [0,.2,0],
224
226
  'mass': 1
225
227
  });
226
228
 
@@ -491,7 +493,12 @@ elation.require(['engine.things.generic', 'engine.things.camera', 'engine.things
491
493
  var theta = angular.length();
492
494
  angular.divideScalar(theta);
493
495
  tmpquat.setFromAxisAngle(angular, theta);
494
- this.properties.orientation.multiply(tmpquat);
496
+ if (this.turnhead) {
497
+ this.neck.properties.orientation.multiply(tmpquat);
498
+ } else {
499
+ this.properties.orientation.multiply(tmpquat);
500
+ this.neck.properties.orientation.set(0,0,0,1);
501
+ }
495
502
  ev.data.mouse_turn = 0;
496
503
  ev.data.mouse_look[0] = 0;
497
504
  changed = true;
@@ -720,6 +727,17 @@ elation.require(['engine.things.generic', 'engine.things.camera', 'engine.things
720
727
  this.camera.fov = this.fov;
721
728
  }
722
729
  }
723
-
730
+ this.updateHeadLock = function() {
731
+ if (this.headconstraint && this.neckconstraint) {
732
+ if (this.turnhead) {
733
+ //this.headconstraint.enabled = false;
734
+ this.neckconstraint.min = 3/4 * -Math.PI/2;
735
+ this.neckconstraint.max = 3/4 * Math.PI/2;
736
+ } else {
737
+ this.neckconstraint.min = 0;
738
+ this.neckconstraint.max = 0;
739
+ }
740
+ }
741
+ }
724
742
  }, elation.engine.things.generic);
725
743
  });