elation-engine 0.9.119 → 0.9.120

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.119",
4
+ "version": "0.9.120",
5
5
  "main": "",
6
6
  "author": "James Baicoianu",
7
7
  "license": "MIT",
@@ -238,6 +238,7 @@ elation.require(["physics.cyclone"], function() {
238
238
  let material1 = new THREE.LineBasicMaterial({color: 0x00ffff, transparent: true, depthWrite: false, depthTest: false, opacity: .05, blending: THREE.AdditiveBlending, linewidth: 4});
239
239
  let material2 = new THREE.LineBasicMaterial({color: 0x00ffff, transparent: true, depthWrite: false, depthTest: true, opacity: .2, blending: THREE.AdditiveBlending, linewidth: 4});
240
240
  this.geometry = geo;
241
+ geo.computeBoundingSphere();
241
242
  let obj = new THREE.Object3D();
242
243
  obj.add(new THREE.LineSegments(geo, material1));
243
244
  obj.add(new THREE.LineSegments(geo, material2));
@@ -428,9 +429,9 @@ elation.require(["physics.cyclone"], function() {
428
429
  this.createBoundingPlane = function(collider) {
429
430
  var plane = new THREE.PlaneGeometry(1000, 1000);
430
431
  var planemat = new THREE.MeshBasicMaterial({color: 0x00ffff, transparent: true, opacity: .04, depthWrite: false, polygonOffset: true, polygonOffsetFactor: -5, polygonOffsetUnits: 1, wireframe: false, blending: THREE.AdditiveBlending });
431
- // FIXME - this only really works for horizontal planes
432
- var mat = new THREE.Matrix4().makeRotationFromQuaternion(new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(1,0,0), -Math.PI/2));
433
- plane.applyMatrix(mat);
432
+ // FIXME - this only really works for horizontal planes
433
+ var mat = new THREE.Matrix4().makeRotationFromQuaternion(new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(1,0,0), -Math.PI/2));
434
+ plane.applyMatrix4(mat);
434
435
  var mesh = new THREE.Mesh(plane, planemat);
435
436
  return mesh;
436
437
  }
@@ -441,7 +442,7 @@ elation.require(["physics.cyclone"], function() {
441
442
  var mesh = new THREE.Mesh(cyl, cylmat);
442
443
  console.log('my offset', collider.offset, collider);
443
444
  let offset = collider.offset.clone();//.multiply(collider.body.scale);
444
- cyl.applyMatrix(new THREE.Matrix4().makeTranslation(offset.x, offset.y, offset.z));
445
+ cyl.applyMatrix4(new THREE.Matrix4().makeTranslation(offset.x, offset.y, offset.z));
445
446
  return mesh;
446
447
  }
447
448
  this.createBoundingMesh = function(collider) {
@@ -814,7 +815,7 @@ console.log('ffff', collision.impulses[i], len);
814
815
  var size = [bbox.max.x - bbox.min.x, bbox.max.y - bbox.min.y, bbox.max.z - bbox.min.z];
815
816
  var offset = [(bbox.max.x + bbox.min.x) / 2, (bbox.max.y - bbox.min.y) / 2, (bbox.max.z + bbox.min.z) / 2];
816
817
  var insidegeo = new THREE.BoxGeometry(size[0], size[1], size[2]);
817
- insidegeo.applyMatrix(new THREE.Matrix4().makeTranslation(offset[0], size[1]/2 + offset[1], offset[2]));
818
+ insidegeo.applyMatrix4(new THREE.Matrix4().makeTranslation(offset[0], size[1]/2 + offset[1], offset[2]));
818
819
  var insidemat_side = new THREE.MeshPhongMaterial({emissive: 0x006666, color: 0x00ffff, opacity: 0.8, transparent: true, depthWrite: false, depthTest: false});
819
820
  var insidemat_top = new THREE.MeshPhongMaterial({emissive: 0x006666, color: 0x00ffff, opacity: 0.5, transparent: true, depthWrite: false, depthTest: false});
820
821
 
@@ -357,7 +357,7 @@ elation.require([
357
357
  this.spawn = function(type, name, spawnargs, parent, autoload) {
358
358
  if (elation.utils.isNull(name)) name = type + Math.floor(Math.random() * 1000000);
359
359
  if (!spawnargs) spawnargs = {};
360
- if (!parent) parent = this.children['default'] || this;
360
+ //if (!parent) parent = this.children['default'] || this;
361
361
  if (typeof autoload == 'undefined') autoload = true;
362
362
 
363
363
  var logprefix = "";
@@ -388,8 +388,10 @@ elation.require([
388
388
  } else {
389
389
  currentobj = elation.engine.things[type]({type: realtype, container: elation.html.create(), name: name, engine: this.engine, client: this.client, properties: spawnargs});
390
390
  }
391
- parent.add(currentobj);
392
- //currentobj.reparent(parent);
391
+ if (parent) {
392
+ parent.add(currentobj);
393
+ //currentobj.reparent(parent);
394
+ }
393
395
 
394
396
  //console.log(logprefix + "\t- added new " + type + ": " + name, currentobj);
395
397
  }