@galacean/engine-physics-lite 1.0.0-alpha.6 → 1.0.0-beta.1

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/dist/module.js CHANGED
@@ -1,73 +1,49 @@
1
- import { Ray, Vector3, Matrix, Quaternion, MathUtil, BoundingBox, BoundingSphere, CollisionUtil } from '@galacean/engine';
1
+ import { Utils, Ray, Vector3, Matrix, Quaternion, MathUtil, BoundingBox, BoundingSphere, CollisionUtil } from '@galacean/engine';
2
2
 
3
- function setPrototypeOf(o, p) {
4
- setPrototypeOf = Object.setPrototypeOf || function setPrototypeOf(o, p) {
5
- o.__proto__ = p;
6
- return o;
7
- };
3
+ function _set_prototype_of(o, p) {
4
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
5
+ o.__proto__ = p;
8
6
 
9
- return setPrototypeOf(o, p);
10
- }
7
+ return o;
8
+ };
11
9
 
12
- function _setPrototypeOf(o, p) {
13
- return setPrototypeOf(o, p);
10
+ return _set_prototype_of(o, p);
14
11
  }
15
12
 
16
13
  function _inherits(subClass, superClass) {
17
- if (typeof superClass !== "function" && superClass !== null) {
18
- throw new TypeError("Super expression must either be null or a function");
19
- }
20
-
21
- subClass.prototype = Object.create(superClass && superClass.prototype, {
22
- constructor: {
23
- value: subClass,
24
- writable: true,
25
- configurable: true
14
+ if (typeof superClass !== "function" && superClass !== null) {
15
+ throw new TypeError("Super expression must either be null or a function");
26
16
  }
27
- });
28
- if (superClass) _setPrototypeOf(subClass, superClass);
17
+
18
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
19
+
20
+ if (superClass) _set_prototype_of(subClass, superClass);
29
21
  }
30
22
 
31
23
  function _defineProperties(target, props) {
32
- for (var i = 0; i < props.length; i++) {
33
- var descriptor = props[i];
34
- descriptor.enumerable = descriptor.enumerable || false;
35
- descriptor.configurable = true;
36
- if ("value" in descriptor) descriptor.writable = true;
37
- Object.defineProperty(target, descriptor.key, descriptor);
38
- }
24
+ for (var i = 0; i < props.length; i++) {
25
+ var descriptor = props[i];
26
+ descriptor.enumerable = descriptor.enumerable || false;
27
+ descriptor.configurable = true;
28
+
29
+ if ("value" in descriptor) descriptor.writable = true;
30
+
31
+ Object.defineProperty(target, descriptor.key, descriptor);
32
+ }
39
33
  }
34
+ function _create_class(Constructor, protoProps, staticProps) {
35
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
36
+ if (staticProps) _defineProperties(Constructor, staticProps);
40
37
 
41
- function _createClass(Constructor, protoProps, staticProps) {
42
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
43
- if (staticProps) _defineProperties(Constructor, staticProps);
44
- return Constructor;
38
+ return Constructor;
45
39
  }
46
40
 
47
41
  function _instanceof(left, right) {
48
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
49
- return !!right[Symbol.hasInstance](left);
50
- } else {
51
- return left instanceof right;
52
- }
42
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
43
+ return !!right[Symbol.hasInstance](left);
44
+ } else return left instanceof right;
53
45
  }
54
46
 
55
- /**
56
- * Fastly remove an element from array.
57
- * @param array - Array
58
- * @param item - Element
59
- */ function removeFromArray(array, item) {
60
- var index = array.indexOf(item);
61
- if (index < 0) {
62
- return false;
63
- }
64
- var last = array.length - 1;
65
- if (index !== last) {
66
- array[index] = array[last];
67
- }
68
- array.length--;
69
- return true;
70
- }
71
47
  /**
72
48
  * Used to update tags.
73
49
  */ var LiteUpdateFlag = /*#__PURE__*/ function() {
@@ -81,7 +57,7 @@ function _instanceof(left, right) {
81
57
  /**
82
58
  * Destroy.
83
59
  */ _proto.destroy = function destroy() {
84
- removeFromArray(this._flags, this);
60
+ Utils.removeFromArray(this._flags, this);
85
61
  this._flags = null;
86
62
  };
87
63
  return LiteUpdateFlag;
@@ -180,8 +156,12 @@ function _instanceof(left, right) {
180
156
  };
181
157
  return LiteColliderShape;
182
158
  }();
183
- LiteColliderShape._ray = new Ray();
184
- LiteColliderShape._tempPoint = new Vector3();
159
+ (function() {
160
+ LiteColliderShape._ray = new Ray();
161
+ })();
162
+ (function() {
163
+ LiteColliderShape._tempPoint = new Vector3();
164
+ })();
185
165
 
186
166
  /**
187
167
  * Used to implement transformation related functions.
@@ -324,7 +304,7 @@ LiteColliderShape._tempPoint = new Vector3();
324
304
  this._dirtyFlag |= type;
325
305
  this._updateFlagManager.distribute();
326
306
  };
327
- _createClass(LiteTransform, [
307
+ _create_class(LiteTransform, [
328
308
  {
329
309
  key: "owner",
330
310
  set: function set(value) {
@@ -473,8 +453,12 @@ LiteColliderShape._tempPoint = new Vector3();
473
453
  ]);
474
454
  return LiteTransform;
475
455
  }();
476
- LiteTransform._tempQuat0 = new Quaternion();
477
- LiteTransform._tempMat42 = new Matrix();
456
+ (function() {
457
+ LiteTransform._tempQuat0 = new Quaternion();
458
+ })();
459
+ (function() {
460
+ LiteTransform._tempMat42 = new Matrix();
461
+ })();
478
462
  var /**
479
463
  * Dirty flag of transform.
480
464
  */ TransformFlag;
@@ -779,7 +763,9 @@ var /**
779
763
  };
780
764
  return LiteBoxColliderShape;
781
765
  }(LiteColliderShape);
782
- LiteBoxColliderShape._tempBox = new BoundingBox();
766
+ (function() {
767
+ LiteBoxColliderShape._tempBox = new BoundingBox();
768
+ })();
783
769
 
784
770
  /**
785
771
  * Sphere collider shape in Lite.
@@ -819,7 +805,7 @@ LiteBoxColliderShape._tempBox = new BoundingBox();
819
805
  return false;
820
806
  }
821
807
  };
822
- _createClass(LiteSphereColliderShape, [
808
+ _create_class(LiteSphereColliderShape, [
823
809
  {
824
810
  key: "worldRadius",
825
811
  get: function get() {
@@ -829,7 +815,9 @@ LiteBoxColliderShape._tempBox = new BoundingBox();
829
815
  ]);
830
816
  return LiteSphereColliderShape;
831
817
  }(LiteColliderShape);
832
- LiteSphereColliderShape._tempSphere = new BoundingSphere();
818
+ (function() {
819
+ LiteSphereColliderShape._tempSphere = new BoundingSphere();
820
+ })();
833
821
 
834
822
  /**
835
823
  * A manager is a collection of colliders and constraints which can interact.
@@ -1081,10 +1069,18 @@ LiteSphereColliderShape._tempSphere = new BoundingSphere();
1081
1069
  };
1082
1070
  return LitePhysicsManager;
1083
1071
  }();
1084
- LitePhysicsManager._tempSphere = new BoundingSphere();
1085
- LitePhysicsManager._tempBox = new BoundingBox();
1086
- LitePhysicsManager._currentHit = new LiteHitResult();
1087
- LitePhysicsManager._hitResult = new LiteHitResult();
1072
+ (function() {
1073
+ LitePhysicsManager._tempSphere = new BoundingSphere();
1074
+ })();
1075
+ (function() {
1076
+ LitePhysicsManager._tempBox = new BoundingBox();
1077
+ })();
1078
+ (function() {
1079
+ LitePhysicsManager._currentHit = new LiteHitResult();
1080
+ })();
1081
+ (function() {
1082
+ LitePhysicsManager._hitResult = new LiteHitResult();
1083
+ })();
1088
1084
  var /**
1089
1085
  * Physics state
1090
1086
  */ TriggerEventState;