mage-engine 3.23.37 → 3.23.38

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.
Files changed (2) hide show
  1. package/dist/mage.js +89 -41
  2. package/package.json +1 -1
package/dist/mage.js CHANGED
@@ -58135,7 +58135,7 @@ function applyMiddleware() {
58135
58135
 
58136
58136
  var thunk = createThunkMiddleware();
58137
58137
  thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
58138
- var version$1 = "3.23.37";
58138
+ var version$1 = "3.23.38";
58139
58139
  var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
58140
58140
  var main = "dist/mage.js";
58141
58141
  var author$1 = {
@@ -60776,8 +60776,13 @@ const tweenTo = function (origin, target) {
60776
60776
  z,
60777
60777
  w
60778
60778
  } = _ref;
60779
+ // Ensure values are numbers (not strings) to prevent rendering issues
60780
+ const qx = Number(x) || 0;
60781
+ const qy = Number(y) || 0;
60782
+ const qz = Number(z) || 0;
60783
+ const qw = Number(w) || 1;
60779
60784
 
60780
- _this.getBody().quaternion.set(x, y, z, w);
60785
+ _this.getBody().quaternion.set(qx, qy, qz, qw);
60781
60786
  });
60782
60787
 
60783
60788
  _defineProperty$1(_assertThisInitialized(_this), "setUuid", uuid => {
@@ -61318,8 +61323,12 @@ const tweenTo = function (origin, target) {
61318
61323
  if (this.hasBody()) {
61319
61324
  const scale = { ...this.getScale(),
61320
61325
  ...howbig
61321
- };
61322
- this.body.scale.set(scale.x, scale.y, scale.z);
61326
+ }; // Ensure values are numbers (not strings) to prevent rendering issues
61327
+
61328
+ const sx = Number(scale.x) || 1;
61329
+ const sy = Number(scale.y) || 1;
61330
+ const sz = Number(scale.z) || 1;
61331
+ this.body.scale.set(sx, sy, sz);
61323
61332
  }
61324
61333
  }
61325
61334
  }, {
@@ -61348,8 +61357,12 @@ const tweenTo = function (origin, target) {
61348
61357
  y,
61349
61358
  z,
61350
61359
  ...where
61351
- };
61352
- this.getBody().position.set(position.x, position.y, position.z);
61360
+ }; // Ensure values are numbers (not strings) to prevent rendering issues
61361
+
61362
+ const px = Number(position.x) || 0;
61363
+ const py = Number(position.y) || 0;
61364
+ const pz = Number(position.z) || 0;
61365
+ this.getBody().position.set(px, py, pz);
61353
61366
  }
61354
61367
  }
61355
61368
  }, {
@@ -61371,8 +61384,12 @@ const tweenTo = function (origin, target) {
61371
61384
  y,
61372
61385
  z,
61373
61386
  ...how
61374
- };
61375
- this.getBody().rotation.set(rotation.x, rotation.y, rotation.z);
61387
+ }; // Ensure values are numbers (not strings) to prevent rendering issues
61388
+
61389
+ const rx = Number(rotation.x) || 0;
61390
+ const ry = Number(rotation.y) || 0;
61391
+ const rz = Number(rotation.z) || 0;
61392
+ this.getBody().rotation.set(rx, ry, rz);
61376
61393
  }
61377
61394
  }
61378
61395
  }, {
@@ -62283,8 +62300,13 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62283
62300
  }, {
62284
62301
  key: "setAngularVelocity",
62285
62302
  value: function setAngularVelocity(velocity) {
62286
- this.angularVelocity = velocity;
62287
- Physics$1.updateAngularVelocity(this.uuid(), velocity);
62303
+ const numericVelocity = {
62304
+ x: Number(velocity === null || velocity === void 0 ? void 0 : velocity.x) || 0,
62305
+ y: Number(velocity === null || velocity === void 0 ? void 0 : velocity.y) || 0,
62306
+ z: Number(velocity === null || velocity === void 0 ? void 0 : velocity.z) || 0
62307
+ };
62308
+ this.angularVelocity = numericVelocity;
62309
+ Physics$1.updateAngularVelocity(this.uuid(), numericVelocity);
62288
62310
  }
62289
62311
  }, {
62290
62312
  key: "getLinearVelocity",
@@ -62294,8 +62316,13 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62294
62316
  }, {
62295
62317
  key: "setLinearVelocity",
62296
62318
  value: function setLinearVelocity(velocity) {
62297
- this.linearVelocity = velocity;
62298
- Physics$1.updateLinearVelocity(this.uuid(), velocity);
62319
+ const numericVelocity = {
62320
+ x: Number(velocity === null || velocity === void 0 ? void 0 : velocity.x) || 0,
62321
+ y: Number(velocity === null || velocity === void 0 ? void 0 : velocity.y) || 0,
62322
+ z: Number(velocity === null || velocity === void 0 ? void 0 : velocity.z) || 0
62323
+ };
62324
+ this.linearVelocity = numericVelocity;
62325
+ Physics$1.updateLinearVelocity(this.uuid(), numericVelocity);
62299
62326
  }
62300
62327
  }, {
62301
62328
  key: "isCollidingOnDirection",
@@ -62316,11 +62343,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62316
62343
  key: "setGeometryRotation",
62317
62344
  value: function setGeometryRotation() {
62318
62345
  let rotation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
62319
- const {
62320
- x = 0,
62321
- y = 0,
62322
- z = 0
62323
- } = rotation;
62346
+ const x = Number(rotation === null || rotation === void 0 ? void 0 : rotation.x) || 0;
62347
+ const y = Number(rotation === null || rotation === void 0 ? void 0 : rotation.y) || 0;
62348
+ const z = Number(rotation === null || rotation === void 0 ? void 0 : rotation.z) || 0;
62324
62349
 
62325
62350
  if (x !== 0) {
62326
62351
  this.getBody().geometry.rotateX(x);
@@ -62376,8 +62401,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62376
62401
  key: "setReflectivity",
62377
62402
  value: function setReflectivity() {
62378
62403
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.REFLECTIVITY];
62404
+ const numericValue = Number(value) || 0;
62379
62405
 
62380
- const _setReflectivity = material => material[PROPERTIES.REFLECTIVITY] = value;
62406
+ const _setReflectivity = material => material[PROPERTIES.REFLECTIVITY] = numericValue;
62381
62407
 
62382
62408
  if (value != undefined) {
62383
62409
  applyMaterialChange(this.getBody(), _setReflectivity);
@@ -62394,8 +62420,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62394
62420
  key: "setRefractionRatio",
62395
62421
  value: function setRefractionRatio() {
62396
62422
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.REFRACTION_RATIO];
62423
+ const numericValue = Number(value) || 0;
62397
62424
 
62398
- const _setRefractionRatio = material => material[PROPERTIES.REFRACTION_RATIO] = value;
62425
+ const _setRefractionRatio = material => material[PROPERTIES.REFRACTION_RATIO] = numericValue;
62399
62426
 
62400
62427
  if (value != undefined) {
62401
62428
  applyMaterialChange(this.getBody(), _setRefractionRatio);
@@ -62468,8 +62495,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62468
62495
  key: "setShininess",
62469
62496
  value: function setShininess() {
62470
62497
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.SHININESS];
62498
+ const numericValue = Number(value) || 0;
62471
62499
 
62472
- const _setShininess = material => material[PROPERTIES.SHININESS] = value;
62500
+ const _setShininess = material => material[PROPERTIES.SHININESS] = numericValue;
62473
62501
 
62474
62502
  applyMaterialChange(this.getBody(), _setShininess);
62475
62503
  }
@@ -62520,8 +62548,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62520
62548
  key: "setMetalness",
62521
62549
  value: function setMetalness() {
62522
62550
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.METALNESS];
62551
+ const numericValue = Number(value) || 0;
62523
62552
 
62524
- const _setMetalness = material => material[PROPERTIES.METALNESS] = value;
62553
+ const _setMetalness = material => material[PROPERTIES.METALNESS] = numericValue;
62525
62554
 
62526
62555
  applyMaterialChange(this.getBody(), _setMetalness);
62527
62556
  }
@@ -62534,8 +62563,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62534
62563
  key: "setRoughness",
62535
62564
  value: function setRoughness() {
62536
62565
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.ROUGHNESS];
62566
+ const numericValue = Number(value) || 0;
62537
62567
 
62538
- const _setRoughness = material => material[PROPERTIES.ROUGHNESS] = value;
62568
+ const _setRoughness = material => material[PROPERTIES.ROUGHNESS] = numericValue;
62539
62569
 
62540
62570
  applyMaterialChange(this.getBody(), _setRoughness);
62541
62571
  }
@@ -62572,8 +62602,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62572
62602
  key: "setEmissiveIntensity",
62573
62603
  value: function setEmissiveIntensity() {
62574
62604
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.EMISSIVE_INTENSITY];
62605
+ const numericValue = Number(value) || 0;
62575
62606
 
62576
- const _setEmissiveIntensity = material => material[PROPERTIES.EMISSIVE_INTENSITY] = value;
62607
+ const _setEmissiveIntensity = material => material[PROPERTIES.EMISSIVE_INTENSITY] = numericValue;
62577
62608
 
62578
62609
  applyMaterialChange(this.getBody(), _setEmissiveIntensity);
62579
62610
  }
@@ -62586,8 +62617,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62586
62617
  key: "setLightMapIntensity",
62587
62618
  value: function setLightMapIntensity() {
62588
62619
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.LIGHT_MAP_INTENSITY];
62620
+ const numericValue = Number(value) || 0;
62589
62621
 
62590
- const _setLightMapIntensity = material => material[PROPERTIES.LIGHT_MAP_INTENSITY] = value;
62622
+ const _setLightMapIntensity = material => material[PROPERTIES.LIGHT_MAP_INTENSITY] = numericValue;
62591
62623
 
62592
62624
  applyMaterialChange(this.getBody(), _setLightMapIntensity);
62593
62625
  }
@@ -62600,8 +62632,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62600
62632
  key: "setAOMapIntensity",
62601
62633
  value: function setAOMapIntensity() {
62602
62634
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.AO_MAP_INTENSITY];
62635
+ const numericValue = Number(value) || 0;
62603
62636
 
62604
- const _setAOMapIntensity = material => material[PROPERTIES.AO_MAP_INTENSITY] = value;
62637
+ const _setAOMapIntensity = material => material[PROPERTIES.AO_MAP_INTENSITY] = numericValue;
62605
62638
 
62606
62639
  applyMaterialChange(this.getBody(), _setAOMapIntensity);
62607
62640
  }
@@ -62614,8 +62647,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62614
62647
  key: "setAoMapIntensity",
62615
62648
  value: function setAoMapIntensity() {
62616
62649
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.AO_MAP_INTENSITY];
62650
+ const numericValue = Number(value) || 0;
62617
62651
 
62618
- const _setAoMapIntensity = material => material[PROPERTIES.AO_MAP_INTENSITY] = value;
62652
+ const _setAoMapIntensity = material => material[PROPERTIES.AO_MAP_INTENSITY] = numericValue;
62619
62653
 
62620
62654
  applyMaterialChange(this.getBody(), _setAoMapIntensity);
62621
62655
  }
@@ -62623,8 +62657,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62623
62657
  key: "setEnvMapIntensity",
62624
62658
  value: function setEnvMapIntensity() {
62625
62659
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.ENV_MAP_INTENSITY];
62660
+ const numericValue = Number(value) || 0;
62626
62661
 
62627
- const _setEnvMapIntensity = material => material[PROPERTIES.ENV_MAP_INTENSITY] = value;
62662
+ const _setEnvMapIntensity = material => material[PROPERTIES.ENV_MAP_INTENSITY] = numericValue;
62628
62663
 
62629
62664
  applyMaterialChange(this.getBody(), _setEnvMapIntensity);
62630
62665
  }
@@ -62637,8 +62672,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62637
62672
  key: "setDisplacementScale",
62638
62673
  value: function setDisplacementScale() {
62639
62674
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.DISPLACEMENT_SCALE];
62675
+ const numericValue = Number(value) || 0;
62640
62676
 
62641
- const _setDisplacementScale = material => material[PROPERTIES.DISPLACEMENT_SCALE] = value;
62677
+ const _setDisplacementScale = material => material[PROPERTIES.DISPLACEMENT_SCALE] = numericValue;
62642
62678
 
62643
62679
  applyMaterialChange(this.getBody(), _setDisplacementScale);
62644
62680
  }
@@ -62651,8 +62687,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62651
62687
  key: "setDisplacementBias",
62652
62688
  value: function setDisplacementBias() {
62653
62689
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.DISPLACEMENT_BIAS];
62690
+ const numericValue = Number(value) || 0;
62654
62691
 
62655
- const _setDisplacementBias = material => material[PROPERTIES.DISPLACEMENT_BIAS] = value;
62692
+ const _setDisplacementBias = material => material[PROPERTIES.DISPLACEMENT_BIAS] = numericValue;
62656
62693
 
62657
62694
  applyMaterialChange(this.getBody(), _setDisplacementBias);
62658
62695
  }
@@ -62665,8 +62702,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62665
62702
  key: "setBumpScale",
62666
62703
  value: function setBumpScale() {
62667
62704
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.BUMP_SCALE];
62705
+ const numericValue = Number(value) || 0;
62668
62706
 
62669
- const _setBumpScale = material => material[PROPERTIES.BUMP_SCALE] = value;
62707
+ const _setBumpScale = material => material[PROPERTIES.BUMP_SCALE] = numericValue;
62670
62708
 
62671
62709
  applyMaterialChange(this.getBody(), _setBumpScale);
62672
62710
  }
@@ -62873,9 +62911,10 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62873
62911
  key: "setWireframeLineWidth",
62874
62912
  value: function setWireframeLineWidth() {
62875
62913
  let width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
62914
+ const numericWidth = Number(width) || 1;
62876
62915
 
62877
62916
  const _setWireframeLineWidth = material => {
62878
- material.wireframeLinewidth = width;
62917
+ material.wireframeLinewidth = numericWidth;
62879
62918
  };
62880
62919
 
62881
62920
  applyMaterialChange(this.getBody(), _setWireframeLineWidth);
@@ -63505,7 +63544,8 @@ let Line = /*#__PURE__*/function (_Element) {
63505
63544
  key: "setThickness",
63506
63545
  value: function setThickness() {
63507
63546
  let thickness = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_LINE_THICKNESS;
63508
- this.body.material.linewidth = thickness;
63547
+ const numericThickness = Number(thickness) || DEFAULT_LINE_THICKNESS;
63548
+ this.body.material.linewidth = numericThickness;
63509
63549
  }
63510
63550
  }, {
63511
63551
  key: "toJSON",
@@ -63816,29 +63856,33 @@ let Sprite = /*#__PURE__*/function (_Element) {
63816
63856
  key: "setRotation",
63817
63857
  value: function setRotation() {
63818
63858
  let rotation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getRotation();
63819
- this.setData("rotation", rotation);
63820
- this.getBody().material.rotation = rotation;
63859
+ const numericRotation = Number(rotation) || 0;
63860
+ this.setData("rotation", numericRotation);
63861
+ this.getBody().material.rotation = numericRotation;
63821
63862
  }
63822
63863
  }, {
63823
63864
  key: "setWidth",
63824
63865
  value: function setWidth() {
63825
63866
  let width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.width;
63826
- this.setData("width", width);
63827
- this.getBody().scale.x = width;
63867
+ const numericWidth = Number(width) || 1;
63868
+ this.setData("width", numericWidth);
63869
+ this.getBody().scale.x = numericWidth;
63828
63870
  }
63829
63871
  }, {
63830
63872
  key: "setHeight",
63831
63873
  value: function setHeight() {
63832
63874
  let height = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.height;
63833
- this.setData("height", height);
63834
- this.getBody().scale.y = height;
63875
+ const numericHeight = Number(height) || 1;
63876
+ this.setData("height", numericHeight);
63877
+ this.getBody().scale.y = numericHeight;
63835
63878
  }
63836
63879
  }, {
63837
63880
  key: "setAnisotropy",
63838
63881
  value: function setAnisotropy() {
63839
63882
  let anisotropy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
63840
- this.setData("anisotropy", anisotropy);
63841
- this.getTexture(TEXTURES.MAP).anisotropy = validateAnisotropy(anisotropy);
63883
+ const numericAnisotropy = Number(anisotropy) || 1;
63884
+ this.setData("anisotropy", numericAnisotropy);
63885
+ this.getTexture(TEXTURES.MAP).anisotropy = validateAnisotropy(numericAnisotropy);
63842
63886
  }
63843
63887
  }, {
63844
63888
  key: "setSizeAttenuation",
@@ -76148,7 +76192,11 @@ const buildFBXLoader = () => {
76148
76192
  const textureLoader = new TextureLoader(this.manager).setCrossOrigin(this.crossOrigin);
76149
76193
 
76150
76194
  if (!isAbsoluteURL$1(texture)) {
76151
- textureLoader.setPath(this.resourcePath || texturePath || path);
76195
+ // Use MAGE_ASSETS_BASE_URL + textures/ as fallback when no texture path is specified
76196
+ // This allows FBX models to find textures in the textures directory of deployed builds
76197
+ const baseUrl = env.MAGE_ASSETS_BASE_URL;
76198
+ const defaultTexturePath = baseUrl ? `${baseUrl}/textures/` : null;
76199
+ textureLoader.setPath(this.resourcePath || texturePath || defaultTexturePath || path);
76152
76200
  }
76153
76201
 
76154
76202
  return new FBXTreeParser(textureLoader, this.manager, this.options).parse(fbxTree);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mage-engine",
3
- "version": "3.23.37",
3
+ "version": "3.23.38",
4
4
  "description": "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.",
5
5
  "main": "dist/mage.js",
6
6
  "author": {