@galacean/engine-physics-lite 0.0.0-experimental-0.9-plus.8 → 0.0.0-experimental-ktx2.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/README.md +2 -2
- package/dist/browser.js +86 -122
- package/dist/browser.min.js +1 -1
- package/dist/main.js +86 -122
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +168 -36465
- package/dist/module.js +84 -122
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/LitePhysics.d.ts +25 -15
- package/types/LitePhysicsManager.d.ts +1 -77
- package/types/LiteUpdateFlag.d.ts +0 -6
- package/types/shape/LiteBoxColliderShape.d.ts +2 -2
package/README.md
CHANGED
|
@@ -21,8 +21,8 @@ import { LitePhysics } from "@galacean/engine-physics-lite";
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
23
|
```typescript
|
|
24
|
-
// Create engine by passing in the HTMLCanvasElement id and adjust canvas size
|
|
25
|
-
const engine =
|
|
24
|
+
// Create engine by passing in the HTMLCanvasElement id and adjust canvas size
|
|
25
|
+
const engine = await WebGLEngine.create({ canvas: "canvas-id" });
|
|
26
26
|
|
|
27
27
|
// Initialize physics manager with LitePhysics.
|
|
28
28
|
engine.physicsManager.initialize(LitePhysics);
|
package/dist/browser.js
CHANGED
|
@@ -4,28 +4,6 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.Galacean = global.Galacean || {}, global.Galacean.PhysicsLite = {}), global.Galacean));
|
|
5
5
|
})(this, (function (exports, engine) { 'use strict';
|
|
6
6
|
|
|
7
|
-
/******************************************************************************
|
|
8
|
-
Copyright (c) Microsoft Corporation.
|
|
9
|
-
|
|
10
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
11
|
-
purpose with or without fee is hereby granted.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
17
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
18
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
20
|
-
***************************************************************************** */
|
|
21
|
-
|
|
22
|
-
function __decorate(decorators, target, key, desc) {
|
|
23
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
25
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
26
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
7
|
function _set_prototype_of(o, p) {
|
|
30
8
|
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
31
9
|
o.__proto__ = p;
|
|
@@ -70,22 +48,6 @@
|
|
|
70
48
|
} else return left instanceof right;
|
|
71
49
|
}
|
|
72
50
|
|
|
73
|
-
/**
|
|
74
|
-
* Fastly remove an element from array.
|
|
75
|
-
* @param array - Array
|
|
76
|
-
* @param item - Element
|
|
77
|
-
*/ function removeFromArray(array, item) {
|
|
78
|
-
var index = array.indexOf(item);
|
|
79
|
-
if (index < 0) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
var last = array.length - 1;
|
|
83
|
-
if (index !== last) {
|
|
84
|
-
array[index] = array[last];
|
|
85
|
-
}
|
|
86
|
-
array.length--;
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
51
|
/**
|
|
90
52
|
* Used to update tags.
|
|
91
53
|
*/ var LiteUpdateFlag = /*#__PURE__*/ function() {
|
|
@@ -99,7 +61,7 @@
|
|
|
99
61
|
/**
|
|
100
62
|
* Destroy.
|
|
101
63
|
*/ _proto.destroy = function destroy() {
|
|
102
|
-
removeFromArray(this._flags, this);
|
|
64
|
+
engine.Utils.removeFromArray(this._flags, this);
|
|
103
65
|
this._flags = null;
|
|
104
66
|
};
|
|
105
67
|
return LiteUpdateFlag;
|
|
@@ -691,6 +653,42 @@
|
|
|
691
653
|
return LiteDynamicCollider;
|
|
692
654
|
}(LiteCollider);
|
|
693
655
|
|
|
656
|
+
/**
|
|
657
|
+
* Physics material describes how to handle colliding objects (friction, bounciness).
|
|
658
|
+
*/ var LitePhysicsMaterial = /*#__PURE__*/ function() {
|
|
659
|
+
function LitePhysicsMaterial(staticFriction, dynamicFriction, bounciness, frictionCombine, bounceCombine) {}
|
|
660
|
+
var _proto = LitePhysicsMaterial.prototype;
|
|
661
|
+
/**
|
|
662
|
+
* {@inheritDoc IPhysicsMaterial.setBounciness }
|
|
663
|
+
*/ _proto.setBounciness = function setBounciness(value) {
|
|
664
|
+
throw "Physics-lite don't support physics material. Use Physics-PhysX instead!";
|
|
665
|
+
};
|
|
666
|
+
/**
|
|
667
|
+
* {@inheritDoc IPhysicsMaterial.setDynamicFriction }
|
|
668
|
+
*/ _proto.setDynamicFriction = function setDynamicFriction(value) {
|
|
669
|
+
throw "Physics-lite don't support physics material. Use Physics-PhysX instead!";
|
|
670
|
+
};
|
|
671
|
+
/**
|
|
672
|
+
* {@inheritDoc IPhysicsMaterial.setStaticFriction }
|
|
673
|
+
*/ _proto.setStaticFriction = function setStaticFriction(value) {
|
|
674
|
+
throw "Physics-lite don't support physics material. Use Physics-PhysX instead!";
|
|
675
|
+
};
|
|
676
|
+
/**
|
|
677
|
+
* {@inheritDoc IPhysicsMaterial.setBounceCombine }
|
|
678
|
+
*/ _proto.setBounceCombine = function setBounceCombine(value) {
|
|
679
|
+
throw "Physics-lite don't support physics material. Use Physics-PhysX instead!";
|
|
680
|
+
};
|
|
681
|
+
/**
|
|
682
|
+
* {@inheritDoc IPhysicsMaterial.setFrictionCombine }
|
|
683
|
+
*/ _proto.setFrictionCombine = function setFrictionCombine(value) {
|
|
684
|
+
throw "Physics-lite don't support physics material. Use Physics-PhysX instead!";
|
|
685
|
+
};
|
|
686
|
+
/**
|
|
687
|
+
* {@inheritDoc IPhysicsMaterial.destroy }
|
|
688
|
+
*/ _proto.destroy = function destroy() {};
|
|
689
|
+
return LitePhysicsMaterial;
|
|
690
|
+
}();
|
|
691
|
+
|
|
694
692
|
/**
|
|
695
693
|
* High-performance unordered array, delete uses exchange method to improve performance, internal capacity only increases.
|
|
696
694
|
*/ var DisorderedArray = /*#__PURE__*/ function() {
|
|
@@ -863,8 +861,8 @@
|
|
|
863
861
|
|
|
864
862
|
/**
|
|
865
863
|
* A manager is a collection of colliders and constraints which can interact.
|
|
866
|
-
*/ var
|
|
867
|
-
function
|
|
864
|
+
*/ var LitePhysicsScene = /*#__PURE__*/ function() {
|
|
865
|
+
function LitePhysicsScene(onContactEnter, onContactExit, onContactStay, onTriggerEnter, onTriggerExit, onTriggerStay) {
|
|
868
866
|
this._colliders = [];
|
|
869
867
|
this._sphere = new engine.BoundingSphere();
|
|
870
868
|
this._box = new engine.BoundingBox();
|
|
@@ -878,7 +876,7 @@
|
|
|
878
876
|
this._onTriggerExit = onTriggerExit;
|
|
879
877
|
this._onTriggerStay = onTriggerStay;
|
|
880
878
|
}
|
|
881
|
-
var _proto =
|
|
879
|
+
var _proto = LitePhysicsScene.prototype;
|
|
882
880
|
/**
|
|
883
881
|
* {@inheritDoc IPhysicsManager.setGravity }
|
|
884
882
|
*/ _proto.setGravity = function setGravity(value) {
|
|
@@ -931,10 +929,10 @@
|
|
|
931
929
|
var colliders = this._colliders;
|
|
932
930
|
var hitResult;
|
|
933
931
|
if (hit) {
|
|
934
|
-
hitResult =
|
|
932
|
+
hitResult = LitePhysicsScene._hitResult;
|
|
935
933
|
}
|
|
936
934
|
var isHit = false;
|
|
937
|
-
var curHit =
|
|
935
|
+
var curHit = LitePhysicsScene._currentHit;
|
|
938
936
|
for(var i = 0, len = colliders.length; i < len; i++){
|
|
939
937
|
var collider = colliders[i];
|
|
940
938
|
if (collider._raycast(ray, onRaycast, curHit)) {
|
|
@@ -990,7 +988,7 @@
|
|
|
990
988
|
for(var i = 0, len = myColliderShapes.length; i < len; i++){
|
|
991
989
|
var myShape = myColliderShapes[i];
|
|
992
990
|
if (_instanceof(myShape, LiteBoxColliderShape)) {
|
|
993
|
-
|
|
991
|
+
LitePhysicsScene._updateWorldBox(myShape, this._box);
|
|
994
992
|
for(var j = 0, len1 = colliders.length; j < len1; j++){
|
|
995
993
|
var colliderShape = colliders[j]._shapes;
|
|
996
994
|
for(var k = 0, len2 = colliderShape.length; k < len2; k++){
|
|
@@ -1017,7 +1015,7 @@
|
|
|
1017
1015
|
}
|
|
1018
1016
|
}
|
|
1019
1017
|
} else if (_instanceof(myShape, LiteSphereColliderShape)) {
|
|
1020
|
-
|
|
1018
|
+
LitePhysicsScene._upWorldSphere(myShape, this._sphere);
|
|
1021
1019
|
for(var j1 = 0, len3 = colliders.length; j1 < len3; j1++){
|
|
1022
1020
|
var colliderShape1 = colliders[j1]._shapes;
|
|
1023
1021
|
for(var k1 = 0, len4 = colliderShape1.length; k1 < len4; k1++){
|
|
@@ -1069,24 +1067,24 @@
|
|
|
1069
1067
|
};
|
|
1070
1068
|
_proto._boxCollision = function _boxCollision(other) {
|
|
1071
1069
|
if (_instanceof(other, LiteBoxColliderShape)) {
|
|
1072
|
-
var box =
|
|
1073
|
-
|
|
1070
|
+
var box = LitePhysicsScene._tempBox;
|
|
1071
|
+
LitePhysicsScene._updateWorldBox(other, box);
|
|
1074
1072
|
return engine.CollisionUtil.intersectsBoxAndBox(box, this._box);
|
|
1075
1073
|
} else if (_instanceof(other, LiteSphereColliderShape)) {
|
|
1076
|
-
var sphere =
|
|
1077
|
-
|
|
1074
|
+
var sphere = LitePhysicsScene._tempSphere;
|
|
1075
|
+
LitePhysicsScene._upWorldSphere(other, sphere);
|
|
1078
1076
|
return engine.CollisionUtil.intersectsSphereAndBox(sphere, this._box);
|
|
1079
1077
|
}
|
|
1080
1078
|
return false;
|
|
1081
1079
|
};
|
|
1082
1080
|
_proto._sphereCollision = function _sphereCollision(other) {
|
|
1083
1081
|
if (_instanceof(other, LiteBoxColliderShape)) {
|
|
1084
|
-
var box =
|
|
1085
|
-
|
|
1082
|
+
var box = LitePhysicsScene._tempBox;
|
|
1083
|
+
LitePhysicsScene._updateWorldBox(other, box);
|
|
1086
1084
|
return engine.CollisionUtil.intersectsSphereAndBox(this._sphere, box);
|
|
1087
1085
|
} else if (_instanceof(other, LiteSphereColliderShape)) {
|
|
1088
|
-
var sphere =
|
|
1089
|
-
|
|
1086
|
+
var sphere = LitePhysicsScene._tempSphere;
|
|
1087
|
+
LitePhysicsScene._upWorldSphere(other, sphere);
|
|
1090
1088
|
return engine.CollisionUtil.intersectsSphereAndSphere(sphere, this._sphere);
|
|
1091
1089
|
}
|
|
1092
1090
|
return false;
|
|
@@ -1095,7 +1093,7 @@
|
|
|
1095
1093
|
* Calculate the bounding box in world space from boxCollider.
|
|
1096
1094
|
* @param boxCollider - The boxCollider to calculate
|
|
1097
1095
|
* @param out - The calculated boundingBox
|
|
1098
|
-
*/
|
|
1096
|
+
*/ LitePhysicsScene._updateWorldBox = function _updateWorldBox(boxCollider, out) {
|
|
1099
1097
|
var mat = boxCollider._transform.worldMatrix;
|
|
1100
1098
|
out.min.copyFrom(boxCollider._boxMin);
|
|
1101
1099
|
out.max.copyFrom(boxCollider._boxMax);
|
|
@@ -1105,23 +1103,23 @@
|
|
|
1105
1103
|
* Get the sphere info of the given sphere collider in world space.
|
|
1106
1104
|
* @param sphereCollider - The given sphere collider
|
|
1107
1105
|
* @param out - The calculated boundingSphere
|
|
1108
|
-
*/
|
|
1106
|
+
*/ LitePhysicsScene._upWorldSphere = function _upWorldSphere(sphereCollider, out) {
|
|
1109
1107
|
engine.Vector3.transformCoordinate(sphereCollider._transform.position, sphereCollider._transform.worldMatrix, out.center);
|
|
1110
1108
|
out.radius = sphereCollider.worldRadius;
|
|
1111
1109
|
};
|
|
1112
|
-
return
|
|
1110
|
+
return LitePhysicsScene;
|
|
1113
1111
|
}();
|
|
1114
1112
|
(function() {
|
|
1115
|
-
|
|
1113
|
+
LitePhysicsScene._tempSphere = new engine.BoundingSphere();
|
|
1116
1114
|
})();
|
|
1117
1115
|
(function() {
|
|
1118
|
-
|
|
1116
|
+
LitePhysicsScene._tempBox = new engine.BoundingBox();
|
|
1119
1117
|
})();
|
|
1120
1118
|
(function() {
|
|
1121
|
-
|
|
1119
|
+
LitePhysicsScene._currentHit = new LiteHitResult();
|
|
1122
1120
|
})();
|
|
1123
1121
|
(function() {
|
|
1124
|
-
|
|
1122
|
+
LitePhysicsScene._hitResult = new LiteHitResult();
|
|
1125
1123
|
})();
|
|
1126
1124
|
var /**
|
|
1127
1125
|
* Physics state
|
|
@@ -1139,42 +1137,6 @@
|
|
|
1139
1137
|
this.index2 = index2;
|
|
1140
1138
|
};
|
|
1141
1139
|
|
|
1142
|
-
/**
|
|
1143
|
-
* Physics material describes how to handle colliding objects (friction, bounciness).
|
|
1144
|
-
*/ var LitePhysicsMaterial = /*#__PURE__*/ function() {
|
|
1145
|
-
function LitePhysicsMaterial(staticFriction, dynamicFriction, bounciness, frictionCombine, bounceCombine) {}
|
|
1146
|
-
var _proto = LitePhysicsMaterial.prototype;
|
|
1147
|
-
/**
|
|
1148
|
-
* {@inheritDoc IPhysicsMaterial.setBounciness }
|
|
1149
|
-
*/ _proto.setBounciness = function setBounciness(value) {
|
|
1150
|
-
throw "Physics-lite don't support physics material. Use Physics-PhysX instead!";
|
|
1151
|
-
};
|
|
1152
|
-
/**
|
|
1153
|
-
* {@inheritDoc IPhysicsMaterial.setDynamicFriction }
|
|
1154
|
-
*/ _proto.setDynamicFriction = function setDynamicFriction(value) {
|
|
1155
|
-
throw "Physics-lite don't support physics material. Use Physics-PhysX instead!";
|
|
1156
|
-
};
|
|
1157
|
-
/**
|
|
1158
|
-
* {@inheritDoc IPhysicsMaterial.setStaticFriction }
|
|
1159
|
-
*/ _proto.setStaticFriction = function setStaticFriction(value) {
|
|
1160
|
-
throw "Physics-lite don't support physics material. Use Physics-PhysX instead!";
|
|
1161
|
-
};
|
|
1162
|
-
/**
|
|
1163
|
-
* {@inheritDoc IPhysicsMaterial.setBounceCombine }
|
|
1164
|
-
*/ _proto.setBounceCombine = function setBounceCombine(value) {
|
|
1165
|
-
throw "Physics-lite don't support physics material. Use Physics-PhysX instead!";
|
|
1166
|
-
};
|
|
1167
|
-
/**
|
|
1168
|
-
* {@inheritDoc IPhysicsMaterial.setFrictionCombine }
|
|
1169
|
-
*/ _proto.setFrictionCombine = function setFrictionCombine(value) {
|
|
1170
|
-
throw "Physics-lite don't support physics material. Use Physics-PhysX instead!";
|
|
1171
|
-
};
|
|
1172
|
-
/**
|
|
1173
|
-
* {@inheritDoc IPhysicsMaterial.destroy }
|
|
1174
|
-
*/ _proto.destroy = function destroy() {};
|
|
1175
|
-
return LitePhysicsMaterial;
|
|
1176
|
-
}();
|
|
1177
|
-
|
|
1178
1140
|
/**
|
|
1179
1141
|
* A static collider component that will not move.
|
|
1180
1142
|
* @remarks Mostly used for object which always stays at the same place and never moves around.
|
|
@@ -1190,81 +1152,83 @@
|
|
|
1190
1152
|
return LiteStaticCollider;
|
|
1191
1153
|
}(LiteCollider);
|
|
1192
1154
|
|
|
1193
|
-
|
|
1194
|
-
* Static interface implement decorator.
|
|
1195
|
-
* https://stackoverflow.com/questions/13955157/how-to-define-static-property-in-typescript-interface
|
|
1196
|
-
*/ function StaticInterfaceImplement() {
|
|
1197
|
-
return function(constructor) {
|
|
1198
|
-
};
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
exports.LitePhysics = /*#__PURE__*/ function() {
|
|
1155
|
+
var LitePhysics = /*#__PURE__*/ function() {
|
|
1202
1156
|
function LitePhysics() {}
|
|
1157
|
+
var _proto = LitePhysics.prototype;
|
|
1158
|
+
/**
|
|
1159
|
+
* {@inheritDoc IPhysics.initialize }
|
|
1160
|
+
*/ _proto.initialize = function initialize() {
|
|
1161
|
+
return Promise.resolve();
|
|
1162
|
+
};
|
|
1203
1163
|
/**
|
|
1204
1164
|
* {@inheritDoc IPhysics.createPhysicsManager }
|
|
1205
|
-
*/
|
|
1206
|
-
return
|
|
1165
|
+
*/ _proto.createPhysicsManager = function createPhysicsManager() {
|
|
1166
|
+
return null;
|
|
1167
|
+
};
|
|
1168
|
+
/**
|
|
1169
|
+
* {@inheritDoc IPhysics.createPhysicsScene }
|
|
1170
|
+
*/ _proto.createPhysicsScene = function createPhysicsScene(physicsManager, onContactBegin, onContactEnd, onContactPersist, onTriggerBegin, onTriggerEnd, onTriggerPersist) {
|
|
1171
|
+
return new LitePhysicsScene(onContactBegin, onContactEnd, onContactPersist, onTriggerBegin, onTriggerEnd, onTriggerPersist);
|
|
1207
1172
|
};
|
|
1208
1173
|
/**
|
|
1209
1174
|
* {@inheritDoc IPhysics.createStaticCollider }
|
|
1210
|
-
*/
|
|
1175
|
+
*/ _proto.createStaticCollider = function createStaticCollider(position, rotation) {
|
|
1211
1176
|
return new LiteStaticCollider(position, rotation);
|
|
1212
1177
|
};
|
|
1213
1178
|
/**
|
|
1214
1179
|
* {@inheritDoc IPhysics.createDynamicCollider }
|
|
1215
|
-
*/
|
|
1180
|
+
*/ _proto.createDynamicCollider = function createDynamicCollider(position, rotation) {
|
|
1216
1181
|
return new LiteDynamicCollider(position, rotation);
|
|
1217
1182
|
};
|
|
1218
1183
|
/**
|
|
1219
1184
|
* {@inheritDoc IPhysics.createCharacterController }
|
|
1220
|
-
*/
|
|
1185
|
+
*/ _proto.createCharacterController = function createCharacterController() {
|
|
1221
1186
|
throw "Physics-lite don't support createCharacterController. Use Physics-PhysX instead!";
|
|
1222
1187
|
};
|
|
1223
1188
|
/**
|
|
1224
1189
|
* {@inheritDoc IPhysics.createPhysicsMaterial }
|
|
1225
|
-
*/
|
|
1190
|
+
*/ _proto.createPhysicsMaterial = function createPhysicsMaterial(staticFriction, dynamicFriction, bounciness, frictionCombine, bounceCombine) {
|
|
1226
1191
|
return new LitePhysicsMaterial(staticFriction, dynamicFriction, bounciness, frictionCombine, bounceCombine);
|
|
1227
1192
|
};
|
|
1228
1193
|
/**
|
|
1229
1194
|
* {@inheritDoc IPhysics.createBoxColliderShape }
|
|
1230
|
-
*/
|
|
1195
|
+
*/ _proto.createBoxColliderShape = function createBoxColliderShape(uniqueID, size, material) {
|
|
1231
1196
|
return new LiteBoxColliderShape(uniqueID, size, material);
|
|
1232
1197
|
};
|
|
1233
1198
|
/**
|
|
1234
1199
|
* {@inheritDoc IPhysics.createSphereColliderShape }
|
|
1235
|
-
*/
|
|
1200
|
+
*/ _proto.createSphereColliderShape = function createSphereColliderShape(uniqueID, radius, material) {
|
|
1236
1201
|
return new LiteSphereColliderShape(uniqueID, radius, material);
|
|
1237
1202
|
};
|
|
1238
1203
|
/**
|
|
1239
1204
|
* {@inheritDoc IPhysics.createPlaneColliderShape }
|
|
1240
|
-
*/
|
|
1205
|
+
*/ _proto.createPlaneColliderShape = function createPlaneColliderShape(uniqueID, material) {
|
|
1241
1206
|
throw "Physics-lite don't support PlaneColliderShape. Use Physics-PhysX instead!";
|
|
1242
1207
|
};
|
|
1243
1208
|
/**
|
|
1244
1209
|
* {@inheritDoc IPhysics.createCapsuleColliderShape }
|
|
1245
|
-
*/
|
|
1210
|
+
*/ _proto.createCapsuleColliderShape = function createCapsuleColliderShape(uniqueID, radius, height, material) {
|
|
1246
1211
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1247
1212
|
};
|
|
1248
1213
|
/**
|
|
1249
1214
|
* {@inheritDoc IPhysics.createFixedJoint }
|
|
1250
|
-
*/
|
|
1215
|
+
*/ _proto.createFixedJoint = function createFixedJoint(collider) {
|
|
1251
1216
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1252
1217
|
};
|
|
1253
1218
|
/**
|
|
1254
1219
|
* {@inheritDoc IPhysics.createHingeJoint }
|
|
1255
|
-
*/
|
|
1220
|
+
*/ _proto.createHingeJoint = function createHingeJoint(collider) {
|
|
1256
1221
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1257
1222
|
};
|
|
1258
1223
|
/**
|
|
1259
1224
|
* {@inheritDoc IPhysics.createSpringJoint }
|
|
1260
|
-
*/
|
|
1225
|
+
*/ _proto.createSpringJoint = function createSpringJoint(collider) {
|
|
1261
1226
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1262
1227
|
};
|
|
1263
1228
|
return LitePhysics;
|
|
1264
1229
|
}();
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
], exports.LitePhysics);
|
|
1230
|
+
|
|
1231
|
+
exports.LitePhysics = LitePhysics;
|
|
1268
1232
|
|
|
1269
1233
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1270
1234
|
|
package/dist/browser.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Galacean=t.Galacean||{},t.Galacean.PhysicsLite={}),t.Galacean)}(this,function(t,e){"use strict";function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function n(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}function s(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e,i){return e&&s(t.prototype,e),i&&s(t,i),t}function r(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}var a,h,l,c,u=function(){function t(t){void 0===t&&(t=[]),this._flags=t,this.flag=!0,this._flags.push(this)}return t.prototype.destroy=function(){(function(t,e){var i=t.indexOf(e);if(!(i<0)){var n=t.length-1;i!==n&&(t[i]=t[n]),t.length--}})(this._flags,this),this._flags=null},t}(),d=function(){function t(){this._updateFlags=[]}var e=t.prototype;return e.register=function(){return new u(this._updateFlags)},e.distribute=function(){for(var t=this._updateFlags,e=t.length-1;e>=0;e--)t[e].flag=!0},t}(),_=function(){function t(){this._transform=new p,this._invModelMatrix=new e.Matrix,this._transform.owner=this,this._inverseWorldMatFlag=this._transform.registerWorldChangeFlag()}var i=t.prototype;return i.setRotation=function(t){console.log("Physics-lite don't support setRotation. Use Physics-PhysX instead!")},i.setPosition=function(t){this._transform.setPosition(t.x,t.y,t.z)},i.setContactOffset=function(t){console.log("Physics-lite don't support setContactOffset. Use Physics-PhysX instead!")},i.setMaterial=function(t){console.log("Physics-lite don't support setMaterial. Use Physics-PhysX instead!")},i.setUniqueID=function(t){this._id=t},i.setIsTrigger=function(t){console.log("Physics-lite don't support setIsTrigger. Use Physics-PhysX instead!")},i.destroy=function(){},i._updateHitResult=function(i,n,s,o,r){void 0===r&&(r=!1);var a=t._tempPoint;i.getPoint(n,a),r||e.Vector3.transformCoordinate(a,this._transform.worldMatrix,a);var h=e.Vector3.distance(o,a);h<s.distance&&(s.point.copyFrom(a),s.distance=h,s.shapeID=this._id)},i._getLocalRay=function(i){var n=this._getInvModelMatrix(),s=t._ray;return e.Vector3.transformCoordinate(i.origin,n,s.origin),e.Vector3.transformNormal(i.direction,n,s.direction),s.direction.normalize(),s},i._getInvModelMatrix=function(){return this._inverseWorldMatFlag.flag&&(e.Matrix.invert(this._transform.worldMatrix,this._invModelMatrix),this._inverseWorldMatFlag.flag=!1),this._invModelMatrix},t}();_._ray=new e.Ray,_._tempPoint=new e.Vector3;var p=function(){function t(){this._position=new e.Vector3,this._rotation=new e.Vector3,this._rotationQuaternion=new e.Quaternion,this._scale=new e.Vector3(1,1,1),this._worldRotationQuaternion=new e.Quaternion,this._localMatrix=new e.Matrix,this._worldMatrix=new e.Matrix,this._updateFlagManager=new d,this._isParentDirty=!0,this._parentTransformCache=null,this._dirtyFlag=188}var i=t.prototype;return i.setPosition=function(t,e,i){this._position.set(t,e,i),this.position=this._position},i.setRotationQuaternion=function(t,e,i,n){this._rotationQuaternion.set(t,e,i,n),this.rotationQuaternion=this._rotationQuaternion},i.setScale=function(t,e,i){this._scale.set(t,e,i),this.scale=this._scale},i.registerWorldChangeFlag=function(){return this._updateFlagManager.register()},i._updateWorldPositionFlag=function(){if(!this._isContainDirtyFlags(132)&&(this._worldAssociatedChange(132),r(this._owner,f)))for(var t=this._owner._shapes,e=0,i=t.length;e<i;e++)t[e]._transform._updateWorldPositionFlag()},i._updateWorldRotationFlag=function(){if(!this._isContainDirtyFlags(152)&&(this._worldAssociatedChange(152),r(this._owner,f)))for(var t=this._owner._shapes,e=0,i=t.length;e<i;e++)t[e]._transform._updateWorldRotationFlag()},i._updateWorldScaleFlag=function(){if(!this._isContainDirtyFlags(160)&&(this._worldAssociatedChange(160),r(this._owner,f)))for(var t=this._owner._shapes,e=0,i=t.length;e<i;e++)t[e]._transform._updateWorldScaleFlag()},i._updateAllWorldFlag=function(){if(!this._isContainDirtyFlags(188)&&(this._worldAssociatedChange(188),r(this._owner,f)))for(var t=this._owner._shapes,e=0,i=t.length;e<i;e++)t[e]._transform._updateAllWorldFlag()},i._getParentTransform=function(){if(!this._isParentDirty)return this._parentTransformCache;var t=null;return r(this._owner,_)&&(t=this._owner._collider._transform),this._parentTransformCache=t,this._isParentDirty=!1,t},i._isContainDirtyFlags=function(t){return(this._dirtyFlag&t)===t},i._isContainDirtyFlag=function(t){return(this._dirtyFlag&t)!=0},i._setDirtyFlagTrue=function(t){this._dirtyFlag|=t},i._setDirtyFlagFalse=function(t){this._dirtyFlag&=~t},i._worldAssociatedChange=function(t){this._dirtyFlag|=t,this._updateFlagManager.distribute()},o(t,[{key:"owner",set:function(t){this._owner=t}},{key:"position",get:function(){return this._position},set:function(t){this._position!==t&&this._position.copyFrom(t),this._setDirtyFlagTrue(64),this._updateWorldPositionFlag()}},{key:"rotationQuaternion",get:function(){return this._isContainDirtyFlag(2)&&(e.Quaternion.rotationEuler(e.MathUtil.degreeToRadian(this._rotation.x),e.MathUtil.degreeToRadian(this._rotation.y),e.MathUtil.degreeToRadian(this._rotation.z),this._rotationQuaternion),this._setDirtyFlagFalse(2)),this._rotationQuaternion},set:function(t){this._rotationQuaternion!==t&&this._rotationQuaternion.copyFrom(t),this._setDirtyFlagTrue(65),this._setDirtyFlagFalse(2),this._updateWorldRotationFlag()}},{key:"worldRotationQuaternion",get:function(){if(this._isContainDirtyFlag(16)){var t=this._getParentTransform();null!=t?e.Quaternion.multiply(t.worldRotationQuaternion,this.rotationQuaternion,this._worldRotationQuaternion):this._worldRotationQuaternion.copyFrom(this.rotationQuaternion),this._setDirtyFlagFalse(16)}return this._worldRotationQuaternion},set:function(i){this._worldRotationQuaternion!==i&&this._worldRotationQuaternion.copyFrom(i);var n=this._getParentTransform();n?(e.Quaternion.invert(n.worldRotationQuaternion,t._tempQuat0),e.Quaternion.multiply(i,t._tempQuat0,this._rotationQuaternion)):this._rotationQuaternion.copyFrom(i),this.rotationQuaternion=this._rotationQuaternion,this._setDirtyFlagFalse(16)}},{key:"scale",get:function(){return this._scale},set:function(t){this._scale!==t&&this._scale.copyFrom(t),this._setDirtyFlagTrue(64),this._updateWorldScaleFlag()}},{key:"localMatrix",get:function(){return this._isContainDirtyFlag(64)&&(e.Matrix.affineTransformation(this._scale,this.rotationQuaternion,this._position,this._localMatrix),this._setDirtyFlagFalse(64)),this._localMatrix},set:function(t){this._localMatrix!==t&&this._localMatrix.copyFrom(t),this._localMatrix.decompose(this._position,this._rotationQuaternion,this._scale),this._setDirtyFlagTrue(1),this._setDirtyFlagFalse(64),this._updateAllWorldFlag()}},{key:"worldMatrix",get:function(){if(this._isContainDirtyFlag(128)){var t=this._getParentTransform();t?e.Matrix.multiply(t.worldMatrix,this.localMatrix,this._worldMatrix):this._worldMatrix.copyFrom(this.localMatrix),this._setDirtyFlagFalse(128)}return this._worldMatrix},set:function(i){this._worldMatrix!==i&&this._worldMatrix.copyFrom(i);var n=this._getParentTransform();n?(e.Matrix.invert(n.worldMatrix,t._tempMat42),e.Matrix.multiply(t._tempMat42,i,this._localMatrix)):this._localMatrix.copyFrom(i),this.localMatrix=this._localMatrix,this._setDirtyFlagFalse(128)}}]),t}();p._tempQuat0=new e.Quaternion,p._tempMat42=new e.Matrix,(a=l||(l={}))[a.LocalEuler=1]="LocalEuler",a[a.LocalQuat=2]="LocalQuat",a[a.WorldPosition=4]="WorldPosition",a[a.WorldEuler=8]="WorldEuler",a[a.WorldQuat=16]="WorldQuat",a[a.WorldScale=32]="WorldScale",a[a.LocalMatrix=64]="LocalMatrix",a[a.WorldMatrix=128]="WorldMatrix",a[a.WmWp=132]="WmWp",a[a.WmWeWq=152]="WmWeWq",a[a.WmWpWeWq=156]="WmWpWeWq",a[a.WmWs=160]="WmWs",a[a.WmWpWs=164]="WmWpWs",a[a.WmWpWeWqWs=188]="WmWpWeWqWs";var f=function(){function t(){this._shapes=[],this._transform=new p,this._transform.owner=this}var e=t.prototype;return e.addShape=function(t){var e=t._collider;e!==this&&(e&&e.removeShape(t),this._shapes.push(t),t._collider=this)},e.removeShape=function(t){var e=this._shapes.indexOf(t);-1!==e&&(this._shapes.splice(e,1),t._collider=null)},e.setWorldTransform=function(t,e){this._transform.setPosition(t.x,t.y,t.z),this._transform.setRotationQuaternion(e.x,e.y,e.z,e.w)},e.getWorldTransform=function(t,e){var i=this._transform,n=i.position,s=i.rotationQuaternion;t.set(n.x,n.y,n.z),e.set(s.x,s.y,s.z,s.w)},e.destroy=function(){},e._raycast=function(t,e,i){i.distance=Number.MAX_VALUE;for(var n=this._shapes,s=0,o=n.length;s<o;s++){var r=n[s];e(r._id)&&r._raycast(t,i)}return i.distance!=Number.MAX_VALUE},t}(),y=function(t){function e(e,i){var n;return(n=t.call(this)||this)._transform.setPosition(e.x,e.y,e.z),n._transform.setRotationQuaternion(i.x,i.y,i.z,i.w),n}n(e,t);var i=e.prototype;return i.addForce=function(t){throw"Physics-lite don't support addForce. Use Physics-PhysX instead!"},i.addTorque=function(t){throw"Physics-lite don't support addTorque. Use Physics-PhysX instead!"},i.move=function(t,e){throw"Physics-lite don't support move. Use Physics-PhysX instead!"},i.sleep=function(){throw"Physics-lite don't support putToSleep. Use Physics-PhysX instead!"},i.setAngularDamping=function(t){throw"Physics-lite don't support setAngularDamping. Use Physics-PhysX instead!"},i.setAngularVelocity=function(t){throw"Physics-lite don't support setAngularVelocity. Use Physics-PhysX instead!"},i.setCenterOfMass=function(t){throw"Physics-lite don't support setCenterOfMass. Use Physics-PhysX instead!"},i.setCollisionDetectionMode=function(t){throw"Physics-lite don't support setCollisionDetectionMode. Use Physics-PhysX instead!"},i.setConstraints=function(t){throw"Physics-lite don't support setConstraints. Use Physics-PhysX instead!"},i.setInertiaTensor=function(t){throw"Physics-lite don't support setInertiaTensor. Use Physics-PhysX instead!"},i.setIsKinematic=function(t){throw"Physics-lite don't support setIsKinematic. Use Physics-PhysX instead!"},i.setLinearDamping=function(t){throw"Physics-lite don't support setLinearDamping. Use Physics-PhysX instead!"},i.setLinearVelocity=function(t){throw"Physics-lite don't support setLinearVelocity. Use Physics-PhysX instead!"},i.setMass=function(t){throw"Physics-lite don't support setMass. Use Physics-PhysX instead!"},i.setMaxAngularVelocity=function(t){throw"Physics-lite don't support setMaxAngularVelocity. Use Physics-PhysX instead!"},i.setMaxDepenetrationVelocity=function(t){throw"Physics-lite don't support setMaxDepenetrationVelocity. Use Physics-PhysX instead!"},i.setSleepThreshold=function(t){throw"Physics-lite don't support setSleepThreshold. Use Physics-PhysX instead!"},i.setSolverIterations=function(t){throw"Physics-lite don't support setSolverIterations. Use Physics-PhysX instead!"},i.wakeUp=function(){throw"Physics-lite don't support wakeUp. Use Physics-PhysX instead!"},e}(f),g=function(){function t(t){void 0===t&&(t=0),this.length=0,this._elements=Array(t)}var e=t.prototype;return e.add=function(t){this.length===this._elements.length?this._elements.push(t):this._elements[this.length]=t,this.length++},e.delete=function(t){var e=this._elements.indexOf(t);this.deleteByIndex(e)},e.get=function(t){if(t>=this.length)throw"Index is out of range.";return this._elements[t]},e.deleteByIndex=function(t){var e=this._elements,i=null,n=this.length-1;return t!==n&&(i=e[n],e[t]=i),this.length--,i},e.garbageCollection=function(){this._elements.length=this.length},t}(),m=function(){this.shapeID=-1,this.distance=0,this.point=new e.Vector3,this.normal=new e.Vector3},P=function(t){function i(i,n,s){var o;return(o=t.call(this)||this)._halfSize=new e.Vector3,o._scale=new e.Vector3(1,1,1),o._boxMin=new e.Vector3(-.5,-.5,-.5),o._boxMax=new e.Vector3(.5,.5,.5),o._id=i,o._halfSize.set(.5*n.x,.5*n.y,.5*n.z),o._setBondingBox(),o}n(i,t);var s=i.prototype;return s.setPosition=function(e){t.prototype.setPosition.call(this,e),this._setBondingBox()},s.setWorldScale=function(t){this._transform.position=this._transform.position.multiply(t),this._scale.copyFrom(t)},s.setSize=function(t){this._halfSize.set(.5*t.x,.5*t.y,.5*t.z),this._setBondingBox()},s._raycast=function(t,e){var n=this._getLocalRay(t),s=i._tempBox;s.min.set(-this._halfSize.x*this._scale.x,-this._halfSize.y*this._scale.y,-this._halfSize.z*this._scale.z),s.max.set(this._halfSize.x*this._scale.x,this._halfSize.y*this._scale.y,this._halfSize.z*this._scale.z);var o=n.intersectBox(s);return -1!==o&&(this._updateHitResult(n,o,e,t.origin),!0)},s._setBondingBox=function(){var t=this._transform.position,i=this._halfSize;e.Vector3.add(t,i,this._boxMax),e.Vector3.subtract(t,i,this._boxMin)},i}(_);P._tempBox=new e.BoundingBox;var x=function(t){function i(e,i,n){var s;return(s=t.call(this)||this)._radius=1,s._maxScale=1,s._radius=i,s._id=e,s}n(i,t);var s=i.prototype;return s.setRadius=function(t){this._radius=t},s.setWorldScale=function(t){this._maxScale=Math.max(t.x,Math.max(t.x,t.y))},s._raycast=function(t,n){var s=i._tempSphere;e.Vector3.transformCoordinate(this._transform.position,this._collider._transform.worldMatrix,s.center),s.radius=this.worldRadius;var o=t.intersectSphere(s);return -1!==o&&(this._updateHitResult(t,o,n,t.origin,!0),!0)},o(i,[{key:"worldRadius",get:function(){return this._radius*this._maxScale}}]),i}(_);x._tempSphere=new e.BoundingSphere;var v=function(){function t(t,i,n,s,o,r){this._colliders=[],this._sphere=new e.BoundingSphere,this._box=new e.BoundingBox,this._currentEvents=new g,this._eventMap={},this._eventPool=[],this._onContactEnter=t,this._onContactExit=i,this._onContactStay=n,this._onTriggerEnter=s,this._onTriggerExit=o,this._onTriggerStay=r}var i=t.prototype;return i.setGravity=function(t){console.log("Physics-lite don't support gravity. Use Physics-PhysX instead!")},i.addColliderShape=function(t){this._eventMap[t._id]={}},i.removeColliderShape=function(t){for(var e=this._eventPool,i=this._currentEvents,n=t._id,s=i.length-1;s>=0;s--){var o=i.get(s);(o.index1==n||o.index2==n)&&(i.deleteByIndex(s),e.push(o))}delete this._eventMap[n]},i.addCollider=function(t){this._colliders.push(t)},i.removeCollider=function(t){var e=this._colliders.indexOf(t);-1!==e&&this._colliders.splice(e,1)},i.update=function(t){for(var e=this._colliders,i=0,n=e.length;i<n;i++)this._collisionDetection(t,e[i]);this._fireEvent()},i.raycast=function(e,i,n,s){var o,r=this._colliders;s&&(o=t._hitResult);for(var a=!1,h=t._currentHit,l=0,c=r.length;l<c;l++)if(r[l]._raycast(e,n,h)&&(a=!0,h.distance<i)){if(!o)return!0;o.normal.copyFrom(h.normal),o.point.copyFrom(h.point),o.distance=h.distance,o.shapeID=h.shapeID,i=h.distance}return!a&&o?(o.shapeID=-1,o.distance=0,o.point.set(0,0,0),o.normal.set(0,0,0)):a&&o&&s(o.shapeID,o.distance,o.point,o.normal),a},i.addCharacterController=function(t){throw"Physics-lite don't support addCharacterController. Use Physics-PhysX instead!"},i.removeCharacterController=function(t){throw"Physics-lite don't support removeCharacterController. Use Physics-PhysX instead!"},i._getTrigger=function(t,e){var i;return this._eventPool.length?((i=this._eventPool.pop()).index1=t,i.index2=e):i=new w(t,e),this._eventMap[t][e]=i,i},i._collisionDetection=function(e,i){for(var n=this._colliders,s=i._shapes,o=0,a=s.length;o<a;o++){var h=s[o];if(r(h,P)){t._updateWorldBox(h,this._box);for(var l=0,c=n.length;l<c;l++)for(var u=n[l]._shapes,d=0,_=u.length;d<_;d++){var p=u[d],f=p._id,y=h._id,g=f<y?this._eventMap[f][y]:this._eventMap[y][f];if((void 0===g||g.alreadyInvoked)&&p!=h&&this._boxCollision(p)){if(void 0===g){var m=f<y?this._getTrigger(f,y):this._getTrigger(y,f);m.state=0,m.alreadyInvoked=!1,this._currentEvents.add(m)}else 0===g.state?(g.state=1,g.alreadyInvoked=!1):1===g.state&&(g.alreadyInvoked=!1)}}}else if(r(h,x)){t._upWorldSphere(h,this._sphere);for(var v=0,w=n.length;v<w;v++)for(var M=n[v]._shapes,F=0,C=M.length;F<C;F++){var W=M[F],S=W._id,U=h._id,D=S<U?this._eventMap[S][U]:this._eventMap[U][S];if((void 0===D||D.alreadyInvoked)&&W!=h&&this._sphereCollision(W)){if(void 0===D){var Q=S<U?this._getTrigger(S,U):this._getTrigger(U,S);Q.state=0,Q.alreadyInvoked=!1,this._currentEvents.add(Q)}else 0===D.state?(D.state=1,D.alreadyInvoked=!1):1===D.state&&(D.alreadyInvoked=!1)}}}}},i._fireEvent=function(){for(var t=this._eventPool,e=this._currentEvents,i=e.length-1;i>=0;i--){var n=e.get(i);n.alreadyInvoked?(n.state=2,this._eventMap[n.index1][n.index2]=void 0,this._onTriggerExit(n.index1,n.index2),e.deleteByIndex(i),t.push(n)):0==n.state?(this._onTriggerEnter(n.index1,n.index2),n.alreadyInvoked=!0):1==n.state&&(this._onTriggerStay(n.index1,n.index2),n.alreadyInvoked=!0)}},i._boxCollision=function(i){if(r(i,P)){var n=t._tempBox;return t._updateWorldBox(i,n),e.CollisionUtil.intersectsBoxAndBox(n,this._box)}if(r(i,x)){var s=t._tempSphere;return t._upWorldSphere(i,s),e.CollisionUtil.intersectsSphereAndBox(s,this._box)}return!1},i._sphereCollision=function(i){if(r(i,P)){var n=t._tempBox;return t._updateWorldBox(i,n),e.CollisionUtil.intersectsSphereAndBox(this._sphere,n)}if(r(i,x)){var s=t._tempSphere;return t._upWorldSphere(i,s),e.CollisionUtil.intersectsSphereAndSphere(s,this._sphere)}return!1},t._updateWorldBox=function(t,i){var n=t._transform.worldMatrix;i.min.copyFrom(t._boxMin),i.max.copyFrom(t._boxMax),e.BoundingBox.transform(i,n,i)},t._upWorldSphere=function(t,i){e.Vector3.transformCoordinate(t._transform.position,t._transform.worldMatrix,i.center),i.radius=t.worldRadius},t}();v._tempSphere=new e.BoundingSphere,v._tempBox=new e.BoundingBox,v._currentHit=new m,v._hitResult=new m,(h=c||(c={}))[h.Enter=0]="Enter",h[h.Stay=1]="Stay",h[h.Exit=2]="Exit";var w=function(t,e){this.alreadyInvoked=!1,this.index1=t,this.index2=e},M=function(){function t(t,e,i,n,s){}var e=t.prototype;return e.setBounciness=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},e.setDynamicFriction=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},e.setStaticFriction=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},e.setBounceCombine=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},e.setFrictionCombine=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},e.destroy=function(){},t}(),F=function(t){function e(e,i){var n;return(n=t.call(this)||this)._transform.setPosition(e.x,e.y,e.z),n._transform.setRotationQuaternion(i.x,i.y,i.z,i.w),n}return n(e,t),e}(f);t.LitePhysics=function(){function t(){}return t.createPhysicsManager=function(t,e,i,n,s,o){return new v(t,e,i,n,s,o)},t.createStaticCollider=function(t,e){return new F(t,e)},t.createDynamicCollider=function(t,e){return new y(t,e)},t.createCharacterController=function(){throw"Physics-lite don't support createCharacterController. Use Physics-PhysX instead!"},t.createPhysicsMaterial=function(t,e,i,n,s){return new M(t,e,i,n,s)},t.createBoxColliderShape=function(t,e,i){return new P(t,e,i)},t.createSphereColliderShape=function(t,e,i){return new x(t,e,i)},t.createPlaneColliderShape=function(t,e){throw"Physics-lite don't support PlaneColliderShape. Use Physics-PhysX instead!"},t.createCapsuleColliderShape=function(t,e,i,n){throw"Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!"},t.createFixedJoint=function(t){throw"Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!"},t.createHingeJoint=function(t){throw"Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!"},t.createSpringJoint=function(t){throw"Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!"},t}(),t.LitePhysics=function(t,e,i,n){var s,o=arguments.length,r=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(o<3?s(r):o>3?s(e,i,r):s(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}([function(t){}],t.LitePhysics),Object.defineProperty(t,"__esModule",{value:!0})});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Galacean=t.Galacean||{},t.Galacean.PhysicsLite={}),t.Galacean)}(this,function(t,e){"use strict";function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function n(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}function s(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e,i){return e&&s(t.prototype,e),i&&s(t,i),t}function r(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}var a,h,l,c,u=function(){function t(t){void 0===t&&(t=[]),this._flags=t,this.flag=!0,this._flags.push(this)}return t.prototype.destroy=function(){e.Utils.removeFromArray(this._flags,this),this._flags=null},t}(),d=function(){function t(){this._updateFlags=[]}var e=t.prototype;return e.register=function(){return new u(this._updateFlags)},e.distribute=function(){for(var t=this._updateFlags,e=t.length-1;e>=0;e--)t[e].flag=!0},t}(),_=function(){function t(){this._transform=new p,this._invModelMatrix=new e.Matrix,this._transform.owner=this,this._inverseWorldMatFlag=this._transform.registerWorldChangeFlag()}var i=t.prototype;return i.setRotation=function(t){console.log("Physics-lite don't support setRotation. Use Physics-PhysX instead!")},i.setPosition=function(t){this._transform.setPosition(t.x,t.y,t.z)},i.setContactOffset=function(t){console.log("Physics-lite don't support setContactOffset. Use Physics-PhysX instead!")},i.setMaterial=function(t){console.log("Physics-lite don't support setMaterial. Use Physics-PhysX instead!")},i.setUniqueID=function(t){this._id=t},i.setIsTrigger=function(t){console.log("Physics-lite don't support setIsTrigger. Use Physics-PhysX instead!")},i.destroy=function(){},i._updateHitResult=function(i,n,s,o,r){void 0===r&&(r=!1);var a=t._tempPoint;i.getPoint(n,a),r||e.Vector3.transformCoordinate(a,this._transform.worldMatrix,a);var h=e.Vector3.distance(o,a);h<s.distance&&(s.point.copyFrom(a),s.distance=h,s.shapeID=this._id)},i._getLocalRay=function(i){var n=this._getInvModelMatrix(),s=t._ray;return e.Vector3.transformCoordinate(i.origin,n,s.origin),e.Vector3.transformNormal(i.direction,n,s.direction),s.direction.normalize(),s},i._getInvModelMatrix=function(){return this._inverseWorldMatFlag.flag&&(e.Matrix.invert(this._transform.worldMatrix,this._invModelMatrix),this._inverseWorldMatFlag.flag=!1),this._invModelMatrix},t}();_._ray=new e.Ray,_._tempPoint=new e.Vector3;var p=function(){function t(){this._position=new e.Vector3,this._rotation=new e.Vector3,this._rotationQuaternion=new e.Quaternion,this._scale=new e.Vector3(1,1,1),this._worldRotationQuaternion=new e.Quaternion,this._localMatrix=new e.Matrix,this._worldMatrix=new e.Matrix,this._updateFlagManager=new d,this._isParentDirty=!0,this._parentTransformCache=null,this._dirtyFlag=188}var i=t.prototype;return i.setPosition=function(t,e,i){this._position.set(t,e,i),this.position=this._position},i.setRotationQuaternion=function(t,e,i,n){this._rotationQuaternion.set(t,e,i,n),this.rotationQuaternion=this._rotationQuaternion},i.setScale=function(t,e,i){this._scale.set(t,e,i),this.scale=this._scale},i.registerWorldChangeFlag=function(){return this._updateFlagManager.register()},i._updateWorldPositionFlag=function(){if(!this._isContainDirtyFlags(132)&&(this._worldAssociatedChange(132),r(this._owner,f)))for(var t=this._owner._shapes,e=0,i=t.length;e<i;e++)t[e]._transform._updateWorldPositionFlag()},i._updateWorldRotationFlag=function(){if(!this._isContainDirtyFlags(152)&&(this._worldAssociatedChange(152),r(this._owner,f)))for(var t=this._owner._shapes,e=0,i=t.length;e<i;e++)t[e]._transform._updateWorldRotationFlag()},i._updateWorldScaleFlag=function(){if(!this._isContainDirtyFlags(160)&&(this._worldAssociatedChange(160),r(this._owner,f)))for(var t=this._owner._shapes,e=0,i=t.length;e<i;e++)t[e]._transform._updateWorldScaleFlag()},i._updateAllWorldFlag=function(){if(!this._isContainDirtyFlags(188)&&(this._worldAssociatedChange(188),r(this._owner,f)))for(var t=this._owner._shapes,e=0,i=t.length;e<i;e++)t[e]._transform._updateAllWorldFlag()},i._getParentTransform=function(){if(!this._isParentDirty)return this._parentTransformCache;var t=null;return r(this._owner,_)&&(t=this._owner._collider._transform),this._parentTransformCache=t,this._isParentDirty=!1,t},i._isContainDirtyFlags=function(t){return(this._dirtyFlag&t)===t},i._isContainDirtyFlag=function(t){return(this._dirtyFlag&t)!=0},i._setDirtyFlagTrue=function(t){this._dirtyFlag|=t},i._setDirtyFlagFalse=function(t){this._dirtyFlag&=~t},i._worldAssociatedChange=function(t){this._dirtyFlag|=t,this._updateFlagManager.distribute()},o(t,[{key:"owner",set:function(t){this._owner=t}},{key:"position",get:function(){return this._position},set:function(t){this._position!==t&&this._position.copyFrom(t),this._setDirtyFlagTrue(64),this._updateWorldPositionFlag()}},{key:"rotationQuaternion",get:function(){return this._isContainDirtyFlag(2)&&(e.Quaternion.rotationEuler(e.MathUtil.degreeToRadian(this._rotation.x),e.MathUtil.degreeToRadian(this._rotation.y),e.MathUtil.degreeToRadian(this._rotation.z),this._rotationQuaternion),this._setDirtyFlagFalse(2)),this._rotationQuaternion},set:function(t){this._rotationQuaternion!==t&&this._rotationQuaternion.copyFrom(t),this._setDirtyFlagTrue(65),this._setDirtyFlagFalse(2),this._updateWorldRotationFlag()}},{key:"worldRotationQuaternion",get:function(){if(this._isContainDirtyFlag(16)){var t=this._getParentTransform();null!=t?e.Quaternion.multiply(t.worldRotationQuaternion,this.rotationQuaternion,this._worldRotationQuaternion):this._worldRotationQuaternion.copyFrom(this.rotationQuaternion),this._setDirtyFlagFalse(16)}return this._worldRotationQuaternion},set:function(i){this._worldRotationQuaternion!==i&&this._worldRotationQuaternion.copyFrom(i);var n=this._getParentTransform();n?(e.Quaternion.invert(n.worldRotationQuaternion,t._tempQuat0),e.Quaternion.multiply(i,t._tempQuat0,this._rotationQuaternion)):this._rotationQuaternion.copyFrom(i),this.rotationQuaternion=this._rotationQuaternion,this._setDirtyFlagFalse(16)}},{key:"scale",get:function(){return this._scale},set:function(t){this._scale!==t&&this._scale.copyFrom(t),this._setDirtyFlagTrue(64),this._updateWorldScaleFlag()}},{key:"localMatrix",get:function(){return this._isContainDirtyFlag(64)&&(e.Matrix.affineTransformation(this._scale,this.rotationQuaternion,this._position,this._localMatrix),this._setDirtyFlagFalse(64)),this._localMatrix},set:function(t){this._localMatrix!==t&&this._localMatrix.copyFrom(t),this._localMatrix.decompose(this._position,this._rotationQuaternion,this._scale),this._setDirtyFlagTrue(1),this._setDirtyFlagFalse(64),this._updateAllWorldFlag()}},{key:"worldMatrix",get:function(){if(this._isContainDirtyFlag(128)){var t=this._getParentTransform();t?e.Matrix.multiply(t.worldMatrix,this.localMatrix,this._worldMatrix):this._worldMatrix.copyFrom(this.localMatrix),this._setDirtyFlagFalse(128)}return this._worldMatrix},set:function(i){this._worldMatrix!==i&&this._worldMatrix.copyFrom(i);var n=this._getParentTransform();n?(e.Matrix.invert(n.worldMatrix,t._tempMat42),e.Matrix.multiply(t._tempMat42,i,this._localMatrix)):this._localMatrix.copyFrom(i),this.localMatrix=this._localMatrix,this._setDirtyFlagFalse(128)}}]),t}();p._tempQuat0=new e.Quaternion,p._tempMat42=new e.Matrix,(a=l||(l={}))[a.LocalEuler=1]="LocalEuler",a[a.LocalQuat=2]="LocalQuat",a[a.WorldPosition=4]="WorldPosition",a[a.WorldEuler=8]="WorldEuler",a[a.WorldQuat=16]="WorldQuat",a[a.WorldScale=32]="WorldScale",a[a.LocalMatrix=64]="LocalMatrix",a[a.WorldMatrix=128]="WorldMatrix",a[a.WmWp=132]="WmWp",a[a.WmWeWq=152]="WmWeWq",a[a.WmWpWeWq=156]="WmWpWeWq",a[a.WmWs=160]="WmWs",a[a.WmWpWs=164]="WmWpWs",a[a.WmWpWeWqWs=188]="WmWpWeWqWs";var f=function(){function t(){this._shapes=[],this._transform=new p,this._transform.owner=this}var e=t.prototype;return e.addShape=function(t){var e=t._collider;e!==this&&(e&&e.removeShape(t),this._shapes.push(t),t._collider=this)},e.removeShape=function(t){var e=this._shapes.indexOf(t);-1!==e&&(this._shapes.splice(e,1),t._collider=null)},e.setWorldTransform=function(t,e){this._transform.setPosition(t.x,t.y,t.z),this._transform.setRotationQuaternion(e.x,e.y,e.z,e.w)},e.getWorldTransform=function(t,e){var i=this._transform,n=i.position,s=i.rotationQuaternion;t.set(n.x,n.y,n.z),e.set(s.x,s.y,s.z,s.w)},e.destroy=function(){},e._raycast=function(t,e,i){i.distance=Number.MAX_VALUE;for(var n=this._shapes,s=0,o=n.length;s<o;s++){var r=n[s];e(r._id)&&r._raycast(t,i)}return i.distance!=Number.MAX_VALUE},t}(),y=function(t){function e(e,i){var n;return(n=t.call(this)||this)._transform.setPosition(e.x,e.y,e.z),n._transform.setRotationQuaternion(i.x,i.y,i.z,i.w),n}n(e,t);var i=e.prototype;return i.addForce=function(t){throw"Physics-lite don't support addForce. Use Physics-PhysX instead!"},i.addTorque=function(t){throw"Physics-lite don't support addTorque. Use Physics-PhysX instead!"},i.move=function(t,e){throw"Physics-lite don't support move. Use Physics-PhysX instead!"},i.sleep=function(){throw"Physics-lite don't support putToSleep. Use Physics-PhysX instead!"},i.setAngularDamping=function(t){throw"Physics-lite don't support setAngularDamping. Use Physics-PhysX instead!"},i.setAngularVelocity=function(t){throw"Physics-lite don't support setAngularVelocity. Use Physics-PhysX instead!"},i.setCenterOfMass=function(t){throw"Physics-lite don't support setCenterOfMass. Use Physics-PhysX instead!"},i.setCollisionDetectionMode=function(t){throw"Physics-lite don't support setCollisionDetectionMode. Use Physics-PhysX instead!"},i.setConstraints=function(t){throw"Physics-lite don't support setConstraints. Use Physics-PhysX instead!"},i.setInertiaTensor=function(t){throw"Physics-lite don't support setInertiaTensor. Use Physics-PhysX instead!"},i.setIsKinematic=function(t){throw"Physics-lite don't support setIsKinematic. Use Physics-PhysX instead!"},i.setLinearDamping=function(t){throw"Physics-lite don't support setLinearDamping. Use Physics-PhysX instead!"},i.setLinearVelocity=function(t){throw"Physics-lite don't support setLinearVelocity. Use Physics-PhysX instead!"},i.setMass=function(t){throw"Physics-lite don't support setMass. Use Physics-PhysX instead!"},i.setMaxAngularVelocity=function(t){throw"Physics-lite don't support setMaxAngularVelocity. Use Physics-PhysX instead!"},i.setMaxDepenetrationVelocity=function(t){throw"Physics-lite don't support setMaxDepenetrationVelocity. Use Physics-PhysX instead!"},i.setSleepThreshold=function(t){throw"Physics-lite don't support setSleepThreshold. Use Physics-PhysX instead!"},i.setSolverIterations=function(t){throw"Physics-lite don't support setSolverIterations. Use Physics-PhysX instead!"},i.wakeUp=function(){throw"Physics-lite don't support wakeUp. Use Physics-PhysX instead!"},e}(f),g=function(){function t(t,e,i,n,s){}var e=t.prototype;return e.setBounciness=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},e.setDynamicFriction=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},e.setStaticFriction=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},e.setBounceCombine=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},e.setFrictionCombine=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},e.destroy=function(){},t}(),m=function(){function t(t){void 0===t&&(t=0),this.length=0,this._elements=Array(t)}var e=t.prototype;return e.add=function(t){this.length===this._elements.length?this._elements.push(t):this._elements[this.length]=t,this.length++},e.delete=function(t){var e=this._elements.indexOf(t);this.deleteByIndex(e)},e.get=function(t){if(t>=this.length)throw"Index is out of range.";return this._elements[t]},e.deleteByIndex=function(t){var e=this._elements,i=null,n=this.length-1;return t!==n&&(i=e[n],e[t]=i),this.length--,i},e.garbageCollection=function(){this._elements.length=this.length},t}(),P=function(){this.shapeID=-1,this.distance=0,this.point=new e.Vector3,this.normal=new e.Vector3},x=function(t){function i(i,n,s){var o;return(o=t.call(this)||this)._halfSize=new e.Vector3,o._scale=new e.Vector3(1,1,1),o._boxMin=new e.Vector3(-.5,-.5,-.5),o._boxMax=new e.Vector3(.5,.5,.5),o._id=i,o._halfSize.set(.5*n.x,.5*n.y,.5*n.z),o._setBondingBox(),o}n(i,t);var s=i.prototype;return s.setPosition=function(e){t.prototype.setPosition.call(this,e),this._setBondingBox()},s.setWorldScale=function(t){this._transform.position=this._transform.position.multiply(t),this._scale.copyFrom(t)},s.setSize=function(t){this._halfSize.set(.5*t.x,.5*t.y,.5*t.z),this._setBondingBox()},s._raycast=function(t,e){var n=this._getLocalRay(t),s=i._tempBox;s.min.set(-this._halfSize.x*this._scale.x,-this._halfSize.y*this._scale.y,-this._halfSize.z*this._scale.z),s.max.set(this._halfSize.x*this._scale.x,this._halfSize.y*this._scale.y,this._halfSize.z*this._scale.z);var o=n.intersectBox(s);return -1!==o&&(this._updateHitResult(n,o,e,t.origin),!0)},s._setBondingBox=function(){var t=this._transform.position,i=this._halfSize;e.Vector3.add(t,i,this._boxMax),e.Vector3.subtract(t,i,this._boxMin)},i}(_);x._tempBox=new e.BoundingBox;var v=function(t){function i(e,i,n){var s;return(s=t.call(this)||this)._radius=1,s._maxScale=1,s._radius=i,s._id=e,s}n(i,t);var s=i.prototype;return s.setRadius=function(t){this._radius=t},s.setWorldScale=function(t){this._maxScale=Math.max(t.x,Math.max(t.x,t.y))},s._raycast=function(t,n){var s=i._tempSphere;e.Vector3.transformCoordinate(this._transform.position,this._collider._transform.worldMatrix,s.center),s.radius=this.worldRadius;var o=t.intersectSphere(s);return -1!==o&&(this._updateHitResult(t,o,n,t.origin,!0),!0)},o(i,[{key:"worldRadius",get:function(){return this._radius*this._maxScale}}]),i}(_);v._tempSphere=new e.BoundingSphere;var w=function(){function t(t,i,n,s,o,r){this._colliders=[],this._sphere=new e.BoundingSphere,this._box=new e.BoundingBox,this._currentEvents=new m,this._eventMap={},this._eventPool=[],this._onContactEnter=t,this._onContactExit=i,this._onContactStay=n,this._onTriggerEnter=s,this._onTriggerExit=o,this._onTriggerStay=r}var i=t.prototype;return i.setGravity=function(t){console.log("Physics-lite don't support gravity. Use Physics-PhysX instead!")},i.addColliderShape=function(t){this._eventMap[t._id]={}},i.removeColliderShape=function(t){for(var e=this._eventPool,i=this._currentEvents,n=t._id,s=i.length-1;s>=0;s--){var o=i.get(s);(o.index1==n||o.index2==n)&&(i.deleteByIndex(s),e.push(o))}delete this._eventMap[n]},i.addCollider=function(t){this._colliders.push(t)},i.removeCollider=function(t){var e=this._colliders.indexOf(t);-1!==e&&this._colliders.splice(e,1)},i.update=function(t){for(var e=this._colliders,i=0,n=e.length;i<n;i++)this._collisionDetection(t,e[i]);this._fireEvent()},i.raycast=function(e,i,n,s){var o,r=this._colliders;s&&(o=t._hitResult);for(var a=!1,h=t._currentHit,l=0,c=r.length;l<c;l++)if(r[l]._raycast(e,n,h)&&(a=!0,h.distance<i)){if(!o)return!0;o.normal.copyFrom(h.normal),o.point.copyFrom(h.point),o.distance=h.distance,o.shapeID=h.shapeID,i=h.distance}return!a&&o?(o.shapeID=-1,o.distance=0,o.point.set(0,0,0),o.normal.set(0,0,0)):a&&o&&s(o.shapeID,o.distance,o.point,o.normal),a},i.addCharacterController=function(t){throw"Physics-lite don't support addCharacterController. Use Physics-PhysX instead!"},i.removeCharacterController=function(t){throw"Physics-lite don't support removeCharacterController. Use Physics-PhysX instead!"},i._getTrigger=function(t,e){var i;return this._eventPool.length?((i=this._eventPool.pop()).index1=t,i.index2=e):i=new M(t,e),this._eventMap[t][e]=i,i},i._collisionDetection=function(e,i){for(var n=this._colliders,s=i._shapes,o=0,a=s.length;o<a;o++){var h=s[o];if(r(h,x)){t._updateWorldBox(h,this._box);for(var l=0,c=n.length;l<c;l++)for(var u=n[l]._shapes,d=0,_=u.length;d<_;d++){var p=u[d],f=p._id,y=h._id,g=f<y?this._eventMap[f][y]:this._eventMap[y][f];if((void 0===g||g.alreadyInvoked)&&p!=h&&this._boxCollision(p)){if(void 0===g){var m=f<y?this._getTrigger(f,y):this._getTrigger(y,f);m.state=0,m.alreadyInvoked=!1,this._currentEvents.add(m)}else 0===g.state?(g.state=1,g.alreadyInvoked=!1):1===g.state&&(g.alreadyInvoked=!1)}}}else if(r(h,v)){t._upWorldSphere(h,this._sphere);for(var P=0,w=n.length;P<w;P++)for(var M=n[P]._shapes,F=0,C=M.length;F<C;F++){var W=M[F],S=W._id,U=h._id,D=S<U?this._eventMap[S][U]:this._eventMap[U][S];if((void 0===D||D.alreadyInvoked)&&W!=h&&this._sphereCollision(W)){if(void 0===D){var Q=S<U?this._getTrigger(S,U):this._getTrigger(U,S);Q.state=0,Q.alreadyInvoked=!1,this._currentEvents.add(Q)}else 0===D.state?(D.state=1,D.alreadyInvoked=!1):1===D.state&&(D.alreadyInvoked=!1)}}}}},i._fireEvent=function(){for(var t=this._eventPool,e=this._currentEvents,i=e.length-1;i>=0;i--){var n=e.get(i);n.alreadyInvoked?(n.state=2,this._eventMap[n.index1][n.index2]=void 0,this._onTriggerExit(n.index1,n.index2),e.deleteByIndex(i),t.push(n)):0==n.state?(this._onTriggerEnter(n.index1,n.index2),n.alreadyInvoked=!0):1==n.state&&(this._onTriggerStay(n.index1,n.index2),n.alreadyInvoked=!0)}},i._boxCollision=function(i){if(r(i,x)){var n=t._tempBox;return t._updateWorldBox(i,n),e.CollisionUtil.intersectsBoxAndBox(n,this._box)}if(r(i,v)){var s=t._tempSphere;return t._upWorldSphere(i,s),e.CollisionUtil.intersectsSphereAndBox(s,this._box)}return!1},i._sphereCollision=function(i){if(r(i,x)){var n=t._tempBox;return t._updateWorldBox(i,n),e.CollisionUtil.intersectsSphereAndBox(this._sphere,n)}if(r(i,v)){var s=t._tempSphere;return t._upWorldSphere(i,s),e.CollisionUtil.intersectsSphereAndSphere(s,this._sphere)}return!1},t._updateWorldBox=function(t,i){var n=t._transform.worldMatrix;i.min.copyFrom(t._boxMin),i.max.copyFrom(t._boxMax),e.BoundingBox.transform(i,n,i)},t._upWorldSphere=function(t,i){e.Vector3.transformCoordinate(t._transform.position,t._transform.worldMatrix,i.center),i.radius=t.worldRadius},t}();w._tempSphere=new e.BoundingSphere,w._tempBox=new e.BoundingBox,w._currentHit=new P,w._hitResult=new P,(h=c||(c={}))[h.Enter=0]="Enter",h[h.Stay=1]="Stay",h[h.Exit=2]="Exit";var M=function(t,e){this.alreadyInvoked=!1,this.index1=t,this.index2=e},F=function(t){function e(e,i){var n;return(n=t.call(this)||this)._transform.setPosition(e.x,e.y,e.z),n._transform.setRotationQuaternion(i.x,i.y,i.z,i.w),n}return n(e,t),e}(f),C=function(){function t(){}var e=t.prototype;return e.initialize=function(){return Promise.resolve()},e.createPhysicsManager=function(){return null},e.createPhysicsScene=function(t,e,i,n,s,o,r){return new w(e,i,n,s,o,r)},e.createStaticCollider=function(t,e){return new F(t,e)},e.createDynamicCollider=function(t,e){return new y(t,e)},e.createCharacterController=function(){throw"Physics-lite don't support createCharacterController. Use Physics-PhysX instead!"},e.createPhysicsMaterial=function(t,e,i,n,s){return new g(t,e,i,n,s)},e.createBoxColliderShape=function(t,e,i){return new x(t,e,i)},e.createSphereColliderShape=function(t,e,i){return new v(t,e,i)},e.createPlaneColliderShape=function(t,e){throw"Physics-lite don't support PlaneColliderShape. Use Physics-PhysX instead!"},e.createCapsuleColliderShape=function(t,e,i,n){throw"Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!"},e.createFixedJoint=function(t){throw"Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!"},e.createHingeJoint=function(t){throw"Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!"},e.createSpringJoint=function(t){throw"Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!"},t}();t.LitePhysics=C,Object.defineProperty(t,"__esModule",{value:!0})});
|