@galacean/engine-physics-lite 1.3.24 → 1.4.0-alpha.0

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/browser.js CHANGED
@@ -176,12 +176,8 @@
176
176
  };
177
177
  return LiteColliderShape;
178
178
  }();
179
- (function() {
180
- LiteColliderShape._ray = new engine.Ray();
181
- })();
182
- (function() {
183
- LiteColliderShape._tempPoint = new engine.Vector3();
184
- })();
179
+ LiteColliderShape._ray = new engine.Ray();
180
+ LiteColliderShape._tempPoint = new engine.Vector3();
185
181
 
186
182
  /**
187
183
  * Used to implement transformation related functions.
@@ -197,7 +193,7 @@
197
193
  this._updateFlagManager = new LiteUpdateFlagManager();
198
194
  this._isParentDirty = true;
199
195
  this._parentTransformCache = null;
200
- this._dirtyFlag = 0xbc;
196
+ this._dirtyFlag = 188;
201
197
  }
202
198
  var _proto = LiteTransform.prototype;
203
199
  /**
@@ -239,8 +235,8 @@
239
235
  * Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
240
236
  * In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix or worldRotationQuaternion) to be false.
241
237
  */ _proto._updateWorldPositionFlag = function _updateWorldPositionFlag() {
242
- if (!this._isContainDirtyFlags(0x84)) {
243
- this._worldAssociatedChange(0x84);
238
+ if (!this._isContainDirtyFlags(132)) {
239
+ this._worldAssociatedChange(132);
244
240
  if (_instanceof(this._owner, LiteCollider)) {
245
241
  var shapes = this._owner._shapes;
246
242
  for(var i = 0, n = shapes.length; i < n; i++){
@@ -256,8 +252,8 @@
256
252
  * Get worldRotation: Will trigger the world rotation(in euler and quaternion) update of itself and world rotation(in quaternion) update of all parent entities.
257
253
  * In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix or worldRotationQuaternion) to be false.
258
254
  */ _proto._updateWorldRotationFlag = function _updateWorldRotationFlag() {
259
- if (!this._isContainDirtyFlags(0x98)) {
260
- this._worldAssociatedChange(0x98);
255
+ if (!this._isContainDirtyFlags(152)) {
256
+ this._worldAssociatedChange(152);
261
257
  if (_instanceof(this._owner, LiteCollider)) {
262
258
  var shapes = this._owner._shapes;
263
259
  for(var i = 0, n = shapes.length; i < n; i++){
@@ -272,8 +268,8 @@
272
268
  * Get worldScale: Will trigger the scaling update of itself and all parent entities.
273
269
  * In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix) to be false.
274
270
  */ _proto._updateWorldScaleFlag = function _updateWorldScaleFlag() {
275
- if (!this._isContainDirtyFlags(0xa0)) {
276
- this._worldAssociatedChange(0xa0);
271
+ if (!this._isContainDirtyFlags(160)) {
272
+ this._worldAssociatedChange(160);
277
273
  if (_instanceof(this._owner, LiteCollider)) {
278
274
  var shapes = this._owner._shapes;
279
275
  for(var i = 0, n = shapes.length; i < n; i++){
@@ -285,8 +281,8 @@
285
281
  /**
286
282
  * Update all world transform property dirty flag, the principle is the same as above.
287
283
  */ _proto._updateAllWorldFlag = function _updateAllWorldFlag() {
288
- if (!this._isContainDirtyFlags(0xbc)) {
289
- this._worldAssociatedChange(0xbc);
284
+ if (!this._isContainDirtyFlags(188)) {
285
+ this._worldAssociatedChange(188);
290
286
  if (_instanceof(this._owner, LiteCollider)) {
291
287
  var shapes = this._owner._shapes;
292
288
  for(var i = 0, n = shapes.length; i < n; i++){
@@ -343,7 +339,7 @@
343
339
  if (this._position !== value) {
344
340
  this._position.copyFrom(value);
345
341
  }
346
- this._setDirtyFlagTrue(0x40);
342
+ this._setDirtyFlagTrue(64);
347
343
  this._updateWorldPositionFlag();
348
344
  }
349
345
  },
@@ -353,9 +349,9 @@
353
349
  * Local rotation, defining the rotation by using a unit quaternion.
354
350
  * @remarks Need to re-assign after modification to ensure that the modification takes effect.
355
351
  */ function get() {
356
- if (this._isContainDirtyFlag(0x2)) {
352
+ if (this._isContainDirtyFlag(2)) {
357
353
  engine.Quaternion.rotationEuler(engine.MathUtil.degreeToRadian(this._rotation.x), engine.MathUtil.degreeToRadian(this._rotation.y), engine.MathUtil.degreeToRadian(this._rotation.z), this._rotationQuaternion);
358
- this._setDirtyFlagFalse(0x2);
354
+ this._setDirtyFlagFalse(2);
359
355
  }
360
356
  return this._rotationQuaternion;
361
357
  },
@@ -363,8 +359,8 @@
363
359
  if (this._rotationQuaternion !== value) {
364
360
  this._rotationQuaternion.copyFrom(value);
365
361
  }
366
- this._setDirtyFlagTrue(0x40 | 0x1);
367
- this._setDirtyFlagFalse(0x2);
362
+ this._setDirtyFlagTrue(64 | 1);
363
+ this._setDirtyFlagFalse(2);
368
364
  this._updateWorldRotationFlag();
369
365
  }
370
366
  },
@@ -374,14 +370,14 @@
374
370
  * World rotation, defining the rotation by using a unit quaternion.
375
371
  * @remarks Need to re-assign after modification to ensure that the modification takes effect.
376
372
  */ function get() {
377
- if (this._isContainDirtyFlag(0x10)) {
373
+ if (this._isContainDirtyFlag(16)) {
378
374
  var parent = this._getParentTransform();
379
375
  if (parent != null) {
380
376
  engine.Quaternion.multiply(parent.worldRotationQuaternion, this.rotationQuaternion, this._worldRotationQuaternion);
381
377
  } else {
382
378
  this._worldRotationQuaternion.copyFrom(this.rotationQuaternion);
383
379
  }
384
- this._setDirtyFlagFalse(0x10);
380
+ this._setDirtyFlagFalse(16);
385
381
  }
386
382
  return this._worldRotationQuaternion;
387
383
  },
@@ -397,7 +393,7 @@
397
393
  this._rotationQuaternion.copyFrom(value);
398
394
  }
399
395
  this.rotationQuaternion = this._rotationQuaternion;
400
- this._setDirtyFlagFalse(0x10);
396
+ this._setDirtyFlagFalse(16);
401
397
  }
402
398
  },
403
399
  {
@@ -412,7 +408,7 @@
412
408
  if (this._scale !== value) {
413
409
  this._scale.copyFrom(value);
414
410
  }
415
- this._setDirtyFlagTrue(0x40);
411
+ this._setDirtyFlagTrue(64);
416
412
  this._updateWorldScaleFlag();
417
413
  }
418
414
  },
@@ -422,9 +418,9 @@
422
418
  * Local matrix.
423
419
  * @remarks Need to re-assign after modification to ensure that the modification takes effect.
424
420
  */ function get() {
425
- if (this._isContainDirtyFlag(0x40)) {
421
+ if (this._isContainDirtyFlag(64)) {
426
422
  engine.Matrix.affineTransformation(this._scale, this.rotationQuaternion, this._position, this._localMatrix);
427
- this._setDirtyFlagFalse(0x40);
423
+ this._setDirtyFlagFalse(64);
428
424
  }
429
425
  return this._localMatrix;
430
426
  },
@@ -433,8 +429,8 @@
433
429
  this._localMatrix.copyFrom(value);
434
430
  }
435
431
  this._localMatrix.decompose(this._position, this._rotationQuaternion, this._scale);
436
- this._setDirtyFlagTrue(0x1);
437
- this._setDirtyFlagFalse(0x40);
432
+ this._setDirtyFlagTrue(1);
433
+ this._setDirtyFlagFalse(64);
438
434
  this._updateAllWorldFlag();
439
435
  }
440
436
  },
@@ -444,14 +440,14 @@
444
440
  * World matrix.
445
441
  * @remarks Need to re-assign after modification to ensure that the modification takes effect.
446
442
  */ function get() {
447
- if (this._isContainDirtyFlag(0x80)) {
443
+ if (this._isContainDirtyFlag(128)) {
448
444
  var parent = this._getParentTransform();
449
445
  if (parent) {
450
446
  engine.Matrix.multiply(parent.worldMatrix, this.localMatrix, this._worldMatrix);
451
447
  } else {
452
448
  this._worldMatrix.copyFrom(this.localMatrix);
453
449
  }
454
- this._setDirtyFlagFalse(0x80);
450
+ this._setDirtyFlagFalse(128);
455
451
  }
456
452
  return this._worldMatrix;
457
453
  },
@@ -467,37 +463,14 @@
467
463
  this._localMatrix.copyFrom(value);
468
464
  }
469
465
  this.localMatrix = this._localMatrix;
470
- this._setDirtyFlagFalse(0x80);
466
+ this._setDirtyFlagFalse(128);
471
467
  }
472
468
  }
473
469
  ]);
474
470
  return LiteTransform;
475
471
  }();
476
- (function() {
477
- LiteTransform._tempQuat0 = new engine.Quaternion();
478
- })();
479
- (function() {
480
- LiteTransform._tempMat42 = new engine.Matrix();
481
- })();
482
- var /**
483
- * Dirty flag of transform.
484
- */ TransformFlag;
485
- (function(TransformFlag) {
486
- TransformFlag[TransformFlag["LocalEuler"] = 0x1] = "LocalEuler";
487
- TransformFlag[TransformFlag["LocalQuat"] = 0x2] = "LocalQuat";
488
- TransformFlag[TransformFlag["WorldPosition"] = 0x4] = "WorldPosition";
489
- TransformFlag[TransformFlag["WorldEuler"] = 0x8] = "WorldEuler";
490
- TransformFlag[TransformFlag["WorldQuat"] = 0x10] = "WorldQuat";
491
- TransformFlag[TransformFlag["WorldScale"] = 0x20] = "WorldScale";
492
- TransformFlag[TransformFlag["LocalMatrix"] = 0x40] = "LocalMatrix";
493
- TransformFlag[TransformFlag["WorldMatrix"] = 0x80] = "WorldMatrix";
494
- TransformFlag[TransformFlag[/** WorldMatrix | WorldPosition */ "WmWp"] = 0x84] = "WmWp";
495
- TransformFlag[TransformFlag[/** WorldMatrix | WorldEuler | WorldQuat */ "WmWeWq"] = 0x98] = "WmWeWq";
496
- TransformFlag[TransformFlag[/** WorldMatrix | WorldPosition | WorldEuler | WorldQuat */ "WmWpWeWq"] = 0x9c] = "WmWpWeWq";
497
- TransformFlag[TransformFlag[/** WorldMatrix | WorldScale */ "WmWs"] = 0xa0] = "WmWs";
498
- TransformFlag[TransformFlag[/** WorldMatrix | WorldPosition | WorldScale */ "WmWpWs"] = 0xa4] = "WmWpWs";
499
- TransformFlag[TransformFlag[/** WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale */ "WmWpWeWqWs"] = 0xbc] = "WmWpWeWqWs";
500
- })(TransformFlag || (TransformFlag = {}));
472
+ LiteTransform._tempQuat0 = new engine.Quaternion();
473
+ LiteTransform._tempMat42 = new engine.Matrix();
501
474
 
502
475
  /**
503
476
  * Abstract class of physical collider.
@@ -561,12 +534,11 @@
561
534
 
562
535
  /**
563
536
  * A dynamic collider can act with self-defined movement or physical force
564
- */ var LiteDynamicCollider = /*#__PURE__*/ function(LiteCollider1) {
565
- _inherits(LiteDynamicCollider, LiteCollider1);
537
+ */ var LiteDynamicCollider = /*#__PURE__*/ function(LiteCollider) {
538
+ _inherits(LiteDynamicCollider, LiteCollider);
566
539
  function LiteDynamicCollider(position, rotation) {
567
540
  var _this;
568
- _this = LiteCollider1.call(this) || this;
569
- /** @internal */ _this._isStaticCollider = false;
541
+ _this = LiteCollider.call(this) || this, /** @internal */ _this._isStaticCollider = false;
570
542
  _this._transform.setPosition(position.x, position.y, position.z);
571
543
  _this._transform.setRotationQuaternion(rotation.x, rotation.y, rotation.z, rotation.w);
572
544
  return _this;
@@ -718,15 +690,11 @@
718
690
 
719
691
  /**
720
692
  * Box collider shape in Lite.
721
- */ var LiteBoxColliderShape = /*#__PURE__*/ function(LiteColliderShape1) {
722
- _inherits(LiteBoxColliderShape, LiteColliderShape1);
693
+ */ var LiteBoxColliderShape = /*#__PURE__*/ function(LiteColliderShape) {
694
+ _inherits(LiteBoxColliderShape, LiteColliderShape);
723
695
  function LiteBoxColliderShape(uniqueID, size, material) {
724
696
  var _this;
725
- _this = LiteColliderShape1.call(this) || this;
726
- _this._halfSize = new engine.Vector3();
727
- _this._sizeScale = new engine.Vector3(1, 1, 1);
728
- /** @internal */ _this._boxMin = new engine.Vector3(-0.5, -0.5, -0.5);
729
- /** @internal */ _this._boxMax = new engine.Vector3(0.5, 0.5, 0.5);
697
+ _this = LiteColliderShape.call(this) || this, _this._halfSize = new engine.Vector3(), _this._sizeScale = new engine.Vector3(1, 1, 1), /** @internal */ _this._boxMin = new engine.Vector3(-0.5, -0.5, -0.5), /** @internal */ _this._boxMax = new engine.Vector3(0.5, 0.5, 0.5);
730
698
  _this._id = uniqueID;
731
699
  _this._halfSize.set(size.x * 0.5, size.y * 0.5, size.z * 0.5);
732
700
  _this._setBondingBox();
@@ -736,13 +704,13 @@
736
704
  /**
737
705
  * {@inheritDoc IColliderShape.setPosition }
738
706
  */ _proto.setPosition = function setPosition(position) {
739
- LiteColliderShape1.prototype.setPosition.call(this, position);
707
+ LiteColliderShape.prototype.setPosition.call(this, position);
740
708
  this._setBondingBox();
741
709
  };
742
710
  /**
743
711
  * {@inheritDoc IColliderShape.setWorldScale }
744
712
  */ _proto.setWorldScale = function setWorldScale(scale) {
745
- LiteColliderShape1.prototype.setWorldScale.call(this, scale);
713
+ LiteColliderShape.prototype.setWorldScale.call(this, scale);
746
714
  this._sizeScale.set(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z));
747
715
  this._setBondingBox();
748
716
  };
@@ -778,19 +746,15 @@
778
746
  };
779
747
  return LiteBoxColliderShape;
780
748
  }(LiteColliderShape);
781
- (function() {
782
- LiteBoxColliderShape._tempBox = new engine.BoundingBox();
783
- })();
749
+ LiteBoxColliderShape._tempBox = new engine.BoundingBox();
784
750
 
785
751
  /**
786
752
  * Sphere collider shape in Lite.
787
- */ var LiteSphereColliderShape = /*#__PURE__*/ function(LiteColliderShape1) {
788
- _inherits(LiteSphereColliderShape, LiteColliderShape1);
753
+ */ var LiteSphereColliderShape = /*#__PURE__*/ function(LiteColliderShape) {
754
+ _inherits(LiteSphereColliderShape, LiteColliderShape);
789
755
  function LiteSphereColliderShape(uniqueID, radius, material) {
790
756
  var _this;
791
- _this = LiteColliderShape1.call(this) || this;
792
- _this._radius = 1;
793
- _this._maxScale = 1;
757
+ _this = LiteColliderShape.call(this) || this, _this._radius = 1, _this._maxScale = 1;
794
758
  _this._radius = radius;
795
759
  _this._id = uniqueID;
796
760
  return _this;
@@ -804,7 +768,7 @@
804
768
  /**
805
769
  * {@inheritDoc IColliderShape.setWorldScale }
806
770
  */ _proto.setWorldScale = function setWorldScale(scale) {
807
- LiteColliderShape1.prototype.setWorldScale.call(this, scale);
771
+ LiteColliderShape.prototype.setWorldScale.call(this, scale);
808
772
  this._maxScale = Math.max(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z));
809
773
  };
810
774
  /**
@@ -831,9 +795,7 @@
831
795
  ]);
832
796
  return LiteSphereColliderShape;
833
797
  }(LiteColliderShape);
834
- (function() {
835
- LiteSphereColliderShape._tempSphere = new engine.BoundingSphere();
836
- })();
798
+ LiteSphereColliderShape._tempSphere = new engine.BoundingSphere();
837
799
 
838
800
  /**
839
801
  * A manager is a collection of colliders and constraints which can interact.
@@ -1099,26 +1061,10 @@
1099
1061
  };
1100
1062
  return LitePhysicsScene;
1101
1063
  }();
1102
- (function() {
1103
- LitePhysicsScene._tempSphere = new engine.BoundingSphere();
1104
- })();
1105
- (function() {
1106
- LitePhysicsScene._tempBox = new engine.BoundingBox();
1107
- })();
1108
- (function() {
1109
- LitePhysicsScene._currentHit = new LiteHitResult();
1110
- })();
1111
- (function() {
1112
- LitePhysicsScene._hitResult = new LiteHitResult();
1113
- })();
1114
- var /**
1115
- * Physics state
1116
- */ TriggerEventState;
1117
- (function(TriggerEventState) {
1118
- TriggerEventState[TriggerEventState["Enter"] = 0] = "Enter";
1119
- TriggerEventState[TriggerEventState["Stay"] = 1] = "Stay";
1120
- TriggerEventState[TriggerEventState["Exit"] = 2] = "Exit";
1121
- })(TriggerEventState || (TriggerEventState = {}));
1064
+ LitePhysicsScene._tempSphere = new engine.BoundingSphere();
1065
+ LitePhysicsScene._tempBox = new engine.BoundingBox();
1066
+ LitePhysicsScene._currentHit = new LiteHitResult();
1067
+ LitePhysicsScene._hitResult = new LiteHitResult();
1122
1068
  /**
1123
1069
  * Trigger event to store interactive object ids and state.
1124
1070
  */ var TriggerEvent = function TriggerEvent(index1, index2) {
@@ -1130,12 +1076,11 @@
1130
1076
  /**
1131
1077
  * A static collider component that will not move.
1132
1078
  * @remarks Mostly used for object which always stays at the same place and never moves around.
1133
- */ var LiteStaticCollider = /*#__PURE__*/ function(LiteCollider1) {
1134
- _inherits(LiteStaticCollider, LiteCollider1);
1079
+ */ var LiteStaticCollider = /*#__PURE__*/ function(LiteCollider) {
1080
+ _inherits(LiteStaticCollider, LiteCollider);
1135
1081
  function LiteStaticCollider(position, rotation) {
1136
1082
  var _this;
1137
- _this = LiteCollider1.call(this) || this;
1138
- /** @internal */ _this._isStaticCollider = true;
1083
+ _this = LiteCollider.call(this) || this, /** @internal */ _this._isStaticCollider = true;
1139
1084
  _this._transform.setPosition(position.x, position.y, position.z);
1140
1085
  _this._transform.setRotationQuaternion(rotation.x, rotation.y, rotation.z, rotation.w);
1141
1086
  return _this;
@@ -1220,7 +1165,7 @@
1220
1165
  }();
1221
1166
 
1222
1167
  //@ts-ignore
1223
- var version = "1.3.24";
1168
+ var version = "1.4.0-alpha.0";
1224
1169
  console.log("Galacean PhysicsLite version: " + version);
1225
1170
 
1226
1171
  exports.LitePhysics = LitePhysics;