@galacean/engine-physics-lite 1.3.23 → 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/module.js CHANGED
@@ -172,12 +172,8 @@ function _instanceof(left, right) {
172
172
  };
173
173
  return LiteColliderShape;
174
174
  }();
175
- (function() {
176
- LiteColliderShape._ray = new Ray();
177
- })();
178
- (function() {
179
- LiteColliderShape._tempPoint = new Vector3();
180
- })();
175
+ LiteColliderShape._ray = new Ray();
176
+ LiteColliderShape._tempPoint = new Vector3();
181
177
 
182
178
  /**
183
179
  * Used to implement transformation related functions.
@@ -193,7 +189,7 @@ function _instanceof(left, right) {
193
189
  this._updateFlagManager = new LiteUpdateFlagManager();
194
190
  this._isParentDirty = true;
195
191
  this._parentTransformCache = null;
196
- this._dirtyFlag = 0xbc;
192
+ this._dirtyFlag = 188;
197
193
  }
198
194
  var _proto = LiteTransform.prototype;
199
195
  /**
@@ -235,8 +231,8 @@ function _instanceof(left, right) {
235
231
  * Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
236
232
  * In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix or worldRotationQuaternion) to be false.
237
233
  */ _proto._updateWorldPositionFlag = function _updateWorldPositionFlag() {
238
- if (!this._isContainDirtyFlags(0x84)) {
239
- this._worldAssociatedChange(0x84);
234
+ if (!this._isContainDirtyFlags(132)) {
235
+ this._worldAssociatedChange(132);
240
236
  if (_instanceof(this._owner, LiteCollider)) {
241
237
  var shapes = this._owner._shapes;
242
238
  for(var i = 0, n = shapes.length; i < n; i++){
@@ -252,8 +248,8 @@ function _instanceof(left, right) {
252
248
  * Get worldRotation: Will trigger the world rotation(in euler and quaternion) update of itself and world rotation(in quaternion) update of all parent entities.
253
249
  * In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix or worldRotationQuaternion) to be false.
254
250
  */ _proto._updateWorldRotationFlag = function _updateWorldRotationFlag() {
255
- if (!this._isContainDirtyFlags(0x98)) {
256
- this._worldAssociatedChange(0x98);
251
+ if (!this._isContainDirtyFlags(152)) {
252
+ this._worldAssociatedChange(152);
257
253
  if (_instanceof(this._owner, LiteCollider)) {
258
254
  var shapes = this._owner._shapes;
259
255
  for(var i = 0, n = shapes.length; i < n; i++){
@@ -268,8 +264,8 @@ function _instanceof(left, right) {
268
264
  * Get worldScale: Will trigger the scaling update of itself and all parent entities.
269
265
  * In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix) to be false.
270
266
  */ _proto._updateWorldScaleFlag = function _updateWorldScaleFlag() {
271
- if (!this._isContainDirtyFlags(0xa0)) {
272
- this._worldAssociatedChange(0xa0);
267
+ if (!this._isContainDirtyFlags(160)) {
268
+ this._worldAssociatedChange(160);
273
269
  if (_instanceof(this._owner, LiteCollider)) {
274
270
  var shapes = this._owner._shapes;
275
271
  for(var i = 0, n = shapes.length; i < n; i++){
@@ -281,8 +277,8 @@ function _instanceof(left, right) {
281
277
  /**
282
278
  * Update all world transform property dirty flag, the principle is the same as above.
283
279
  */ _proto._updateAllWorldFlag = function _updateAllWorldFlag() {
284
- if (!this._isContainDirtyFlags(0xbc)) {
285
- this._worldAssociatedChange(0xbc);
280
+ if (!this._isContainDirtyFlags(188)) {
281
+ this._worldAssociatedChange(188);
286
282
  if (_instanceof(this._owner, LiteCollider)) {
287
283
  var shapes = this._owner._shapes;
288
284
  for(var i = 0, n = shapes.length; i < n; i++){
@@ -339,7 +335,7 @@ function _instanceof(left, right) {
339
335
  if (this._position !== value) {
340
336
  this._position.copyFrom(value);
341
337
  }
342
- this._setDirtyFlagTrue(0x40);
338
+ this._setDirtyFlagTrue(64);
343
339
  this._updateWorldPositionFlag();
344
340
  }
345
341
  },
@@ -349,9 +345,9 @@ function _instanceof(left, right) {
349
345
  * Local rotation, defining the rotation by using a unit quaternion.
350
346
  * @remarks Need to re-assign after modification to ensure that the modification takes effect.
351
347
  */ function get() {
352
- if (this._isContainDirtyFlag(0x2)) {
348
+ if (this._isContainDirtyFlag(2)) {
353
349
  Quaternion.rotationEuler(MathUtil.degreeToRadian(this._rotation.x), MathUtil.degreeToRadian(this._rotation.y), MathUtil.degreeToRadian(this._rotation.z), this._rotationQuaternion);
354
- this._setDirtyFlagFalse(0x2);
350
+ this._setDirtyFlagFalse(2);
355
351
  }
356
352
  return this._rotationQuaternion;
357
353
  },
@@ -359,8 +355,8 @@ function _instanceof(left, right) {
359
355
  if (this._rotationQuaternion !== value) {
360
356
  this._rotationQuaternion.copyFrom(value);
361
357
  }
362
- this._setDirtyFlagTrue(0x40 | 0x1);
363
- this._setDirtyFlagFalse(0x2);
358
+ this._setDirtyFlagTrue(64 | 1);
359
+ this._setDirtyFlagFalse(2);
364
360
  this._updateWorldRotationFlag();
365
361
  }
366
362
  },
@@ -370,14 +366,14 @@ function _instanceof(left, right) {
370
366
  * World rotation, defining the rotation by using a unit quaternion.
371
367
  * @remarks Need to re-assign after modification to ensure that the modification takes effect.
372
368
  */ function get() {
373
- if (this._isContainDirtyFlag(0x10)) {
369
+ if (this._isContainDirtyFlag(16)) {
374
370
  var parent = this._getParentTransform();
375
371
  if (parent != null) {
376
372
  Quaternion.multiply(parent.worldRotationQuaternion, this.rotationQuaternion, this._worldRotationQuaternion);
377
373
  } else {
378
374
  this._worldRotationQuaternion.copyFrom(this.rotationQuaternion);
379
375
  }
380
- this._setDirtyFlagFalse(0x10);
376
+ this._setDirtyFlagFalse(16);
381
377
  }
382
378
  return this._worldRotationQuaternion;
383
379
  },
@@ -393,7 +389,7 @@ function _instanceof(left, right) {
393
389
  this._rotationQuaternion.copyFrom(value);
394
390
  }
395
391
  this.rotationQuaternion = this._rotationQuaternion;
396
- this._setDirtyFlagFalse(0x10);
392
+ this._setDirtyFlagFalse(16);
397
393
  }
398
394
  },
399
395
  {
@@ -408,7 +404,7 @@ function _instanceof(left, right) {
408
404
  if (this._scale !== value) {
409
405
  this._scale.copyFrom(value);
410
406
  }
411
- this._setDirtyFlagTrue(0x40);
407
+ this._setDirtyFlagTrue(64);
412
408
  this._updateWorldScaleFlag();
413
409
  }
414
410
  },
@@ -418,9 +414,9 @@ function _instanceof(left, right) {
418
414
  * Local matrix.
419
415
  * @remarks Need to re-assign after modification to ensure that the modification takes effect.
420
416
  */ function get() {
421
- if (this._isContainDirtyFlag(0x40)) {
417
+ if (this._isContainDirtyFlag(64)) {
422
418
  Matrix.affineTransformation(this._scale, this.rotationQuaternion, this._position, this._localMatrix);
423
- this._setDirtyFlagFalse(0x40);
419
+ this._setDirtyFlagFalse(64);
424
420
  }
425
421
  return this._localMatrix;
426
422
  },
@@ -429,8 +425,8 @@ function _instanceof(left, right) {
429
425
  this._localMatrix.copyFrom(value);
430
426
  }
431
427
  this._localMatrix.decompose(this._position, this._rotationQuaternion, this._scale);
432
- this._setDirtyFlagTrue(0x1);
433
- this._setDirtyFlagFalse(0x40);
428
+ this._setDirtyFlagTrue(1);
429
+ this._setDirtyFlagFalse(64);
434
430
  this._updateAllWorldFlag();
435
431
  }
436
432
  },
@@ -440,14 +436,14 @@ function _instanceof(left, right) {
440
436
  * World matrix.
441
437
  * @remarks Need to re-assign after modification to ensure that the modification takes effect.
442
438
  */ function get() {
443
- if (this._isContainDirtyFlag(0x80)) {
439
+ if (this._isContainDirtyFlag(128)) {
444
440
  var parent = this._getParentTransform();
445
441
  if (parent) {
446
442
  Matrix.multiply(parent.worldMatrix, this.localMatrix, this._worldMatrix);
447
443
  } else {
448
444
  this._worldMatrix.copyFrom(this.localMatrix);
449
445
  }
450
- this._setDirtyFlagFalse(0x80);
446
+ this._setDirtyFlagFalse(128);
451
447
  }
452
448
  return this._worldMatrix;
453
449
  },
@@ -463,37 +459,14 @@ function _instanceof(left, right) {
463
459
  this._localMatrix.copyFrom(value);
464
460
  }
465
461
  this.localMatrix = this._localMatrix;
466
- this._setDirtyFlagFalse(0x80);
462
+ this._setDirtyFlagFalse(128);
467
463
  }
468
464
  }
469
465
  ]);
470
466
  return LiteTransform;
471
467
  }();
472
- (function() {
473
- LiteTransform._tempQuat0 = new Quaternion();
474
- })();
475
- (function() {
476
- LiteTransform._tempMat42 = new Matrix();
477
- })();
478
- var /**
479
- * Dirty flag of transform.
480
- */ TransformFlag;
481
- (function(TransformFlag) {
482
- TransformFlag[TransformFlag["LocalEuler"] = 0x1] = "LocalEuler";
483
- TransformFlag[TransformFlag["LocalQuat"] = 0x2] = "LocalQuat";
484
- TransformFlag[TransformFlag["WorldPosition"] = 0x4] = "WorldPosition";
485
- TransformFlag[TransformFlag["WorldEuler"] = 0x8] = "WorldEuler";
486
- TransformFlag[TransformFlag["WorldQuat"] = 0x10] = "WorldQuat";
487
- TransformFlag[TransformFlag["WorldScale"] = 0x20] = "WorldScale";
488
- TransformFlag[TransformFlag["LocalMatrix"] = 0x40] = "LocalMatrix";
489
- TransformFlag[TransformFlag["WorldMatrix"] = 0x80] = "WorldMatrix";
490
- TransformFlag[TransformFlag[/** WorldMatrix | WorldPosition */ "WmWp"] = 0x84] = "WmWp";
491
- TransformFlag[TransformFlag[/** WorldMatrix | WorldEuler | WorldQuat */ "WmWeWq"] = 0x98] = "WmWeWq";
492
- TransformFlag[TransformFlag[/** WorldMatrix | WorldPosition | WorldEuler | WorldQuat */ "WmWpWeWq"] = 0x9c] = "WmWpWeWq";
493
- TransformFlag[TransformFlag[/** WorldMatrix | WorldScale */ "WmWs"] = 0xa0] = "WmWs";
494
- TransformFlag[TransformFlag[/** WorldMatrix | WorldPosition | WorldScale */ "WmWpWs"] = 0xa4] = "WmWpWs";
495
- TransformFlag[TransformFlag[/** WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale */ "WmWpWeWqWs"] = 0xbc] = "WmWpWeWqWs";
496
- })(TransformFlag || (TransformFlag = {}));
468
+ LiteTransform._tempQuat0 = new Quaternion();
469
+ LiteTransform._tempMat42 = new Matrix();
497
470
 
498
471
  /**
499
472
  * Abstract class of physical collider.
@@ -557,12 +530,11 @@ var /**
557
530
 
558
531
  /**
559
532
  * A dynamic collider can act with self-defined movement or physical force
560
- */ var LiteDynamicCollider = /*#__PURE__*/ function(LiteCollider1) {
561
- _inherits(LiteDynamicCollider, LiteCollider1);
533
+ */ var LiteDynamicCollider = /*#__PURE__*/ function(LiteCollider) {
534
+ _inherits(LiteDynamicCollider, LiteCollider);
562
535
  function LiteDynamicCollider(position, rotation) {
563
536
  var _this;
564
- _this = LiteCollider1.call(this) || this;
565
- /** @internal */ _this._isStaticCollider = false;
537
+ _this = LiteCollider.call(this) || this, /** @internal */ _this._isStaticCollider = false;
566
538
  _this._transform.setPosition(position.x, position.y, position.z);
567
539
  _this._transform.setRotationQuaternion(rotation.x, rotation.y, rotation.z, rotation.w);
568
540
  return _this;
@@ -714,15 +686,11 @@ var /**
714
686
 
715
687
  /**
716
688
  * Box collider shape in Lite.
717
- */ var LiteBoxColliderShape = /*#__PURE__*/ function(LiteColliderShape1) {
718
- _inherits(LiteBoxColliderShape, LiteColliderShape1);
689
+ */ var LiteBoxColliderShape = /*#__PURE__*/ function(LiteColliderShape) {
690
+ _inherits(LiteBoxColliderShape, LiteColliderShape);
719
691
  function LiteBoxColliderShape(uniqueID, size, material) {
720
692
  var _this;
721
- _this = LiteColliderShape1.call(this) || this;
722
- _this._halfSize = new Vector3();
723
- _this._sizeScale = new Vector3(1, 1, 1);
724
- /** @internal */ _this._boxMin = new Vector3(-0.5, -0.5, -0.5);
725
- /** @internal */ _this._boxMax = new Vector3(0.5, 0.5, 0.5);
693
+ _this = LiteColliderShape.call(this) || this, _this._halfSize = new Vector3(), _this._sizeScale = new Vector3(1, 1, 1), /** @internal */ _this._boxMin = new Vector3(-0.5, -0.5, -0.5), /** @internal */ _this._boxMax = new Vector3(0.5, 0.5, 0.5);
726
694
  _this._id = uniqueID;
727
695
  _this._halfSize.set(size.x * 0.5, size.y * 0.5, size.z * 0.5);
728
696
  _this._setBondingBox();
@@ -732,13 +700,13 @@ var /**
732
700
  /**
733
701
  * {@inheritDoc IColliderShape.setPosition }
734
702
  */ _proto.setPosition = function setPosition(position) {
735
- LiteColliderShape1.prototype.setPosition.call(this, position);
703
+ LiteColliderShape.prototype.setPosition.call(this, position);
736
704
  this._setBondingBox();
737
705
  };
738
706
  /**
739
707
  * {@inheritDoc IColliderShape.setWorldScale }
740
708
  */ _proto.setWorldScale = function setWorldScale(scale) {
741
- LiteColliderShape1.prototype.setWorldScale.call(this, scale);
709
+ LiteColliderShape.prototype.setWorldScale.call(this, scale);
742
710
  this._sizeScale.set(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z));
743
711
  this._setBondingBox();
744
712
  };
@@ -774,19 +742,15 @@ var /**
774
742
  };
775
743
  return LiteBoxColliderShape;
776
744
  }(LiteColliderShape);
777
- (function() {
778
- LiteBoxColliderShape._tempBox = new BoundingBox();
779
- })();
745
+ LiteBoxColliderShape._tempBox = new BoundingBox();
780
746
 
781
747
  /**
782
748
  * Sphere collider shape in Lite.
783
- */ var LiteSphereColliderShape = /*#__PURE__*/ function(LiteColliderShape1) {
784
- _inherits(LiteSphereColliderShape, LiteColliderShape1);
749
+ */ var LiteSphereColliderShape = /*#__PURE__*/ function(LiteColliderShape) {
750
+ _inherits(LiteSphereColliderShape, LiteColliderShape);
785
751
  function LiteSphereColliderShape(uniqueID, radius, material) {
786
752
  var _this;
787
- _this = LiteColliderShape1.call(this) || this;
788
- _this._radius = 1;
789
- _this._maxScale = 1;
753
+ _this = LiteColliderShape.call(this) || this, _this._radius = 1, _this._maxScale = 1;
790
754
  _this._radius = radius;
791
755
  _this._id = uniqueID;
792
756
  return _this;
@@ -800,7 +764,7 @@ var /**
800
764
  /**
801
765
  * {@inheritDoc IColliderShape.setWorldScale }
802
766
  */ _proto.setWorldScale = function setWorldScale(scale) {
803
- LiteColliderShape1.prototype.setWorldScale.call(this, scale);
767
+ LiteColliderShape.prototype.setWorldScale.call(this, scale);
804
768
  this._maxScale = Math.max(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z));
805
769
  };
806
770
  /**
@@ -827,9 +791,7 @@ var /**
827
791
  ]);
828
792
  return LiteSphereColliderShape;
829
793
  }(LiteColliderShape);
830
- (function() {
831
- LiteSphereColliderShape._tempSphere = new BoundingSphere();
832
- })();
794
+ LiteSphereColliderShape._tempSphere = new BoundingSphere();
833
795
 
834
796
  /**
835
797
  * A manager is a collection of colliders and constraints which can interact.
@@ -1095,26 +1057,10 @@ var /**
1095
1057
  };
1096
1058
  return LitePhysicsScene;
1097
1059
  }();
1098
- (function() {
1099
- LitePhysicsScene._tempSphere = new BoundingSphere();
1100
- })();
1101
- (function() {
1102
- LitePhysicsScene._tempBox = new BoundingBox();
1103
- })();
1104
- (function() {
1105
- LitePhysicsScene._currentHit = new LiteHitResult();
1106
- })();
1107
- (function() {
1108
- LitePhysicsScene._hitResult = new LiteHitResult();
1109
- })();
1110
- var /**
1111
- * Physics state
1112
- */ TriggerEventState;
1113
- (function(TriggerEventState) {
1114
- TriggerEventState[TriggerEventState["Enter"] = 0] = "Enter";
1115
- TriggerEventState[TriggerEventState["Stay"] = 1] = "Stay";
1116
- TriggerEventState[TriggerEventState["Exit"] = 2] = "Exit";
1117
- })(TriggerEventState || (TriggerEventState = {}));
1060
+ LitePhysicsScene._tempSphere = new BoundingSphere();
1061
+ LitePhysicsScene._tempBox = new BoundingBox();
1062
+ LitePhysicsScene._currentHit = new LiteHitResult();
1063
+ LitePhysicsScene._hitResult = new LiteHitResult();
1118
1064
  /**
1119
1065
  * Trigger event to store interactive object ids and state.
1120
1066
  */ var TriggerEvent = function TriggerEvent(index1, index2) {
@@ -1126,12 +1072,11 @@ var /**
1126
1072
  /**
1127
1073
  * A static collider component that will not move.
1128
1074
  * @remarks Mostly used for object which always stays at the same place and never moves around.
1129
- */ var LiteStaticCollider = /*#__PURE__*/ function(LiteCollider1) {
1130
- _inherits(LiteStaticCollider, LiteCollider1);
1075
+ */ var LiteStaticCollider = /*#__PURE__*/ function(LiteCollider) {
1076
+ _inherits(LiteStaticCollider, LiteCollider);
1131
1077
  function LiteStaticCollider(position, rotation) {
1132
1078
  var _this;
1133
- _this = LiteCollider1.call(this) || this;
1134
- /** @internal */ _this._isStaticCollider = true;
1079
+ _this = LiteCollider.call(this) || this, /** @internal */ _this._isStaticCollider = true;
1135
1080
  _this._transform.setPosition(position.x, position.y, position.z);
1136
1081
  _this._transform.setRotationQuaternion(rotation.x, rotation.y, rotation.z, rotation.w);
1137
1082
  return _this;
@@ -1216,7 +1161,7 @@ var LitePhysics = /*#__PURE__*/ function() {
1216
1161
  }();
1217
1162
 
1218
1163
  //@ts-ignore
1219
- var version = "1.3.23";
1164
+ var version = "1.4.0-alpha.0";
1220
1165
  console.log("Galacean PhysicsLite version: " + version);
1221
1166
 
1222
1167
  export { LitePhysics, version };