@galacean/engine-physics-lite 0.0.0-experimental-0.9-plus.8 → 0.0.0-experimental-double11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/browser.js +32 -75
- package/dist/browser.min.js +1 -1
- package/dist/main.js +32 -75
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +116 -36420
- package/dist/module.js +30 -75
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/LitePhysics.d.ts +19 -15
- package/types/LiteUpdateFlag.d.ts +0 -6
- package/types/shape/LiteBoxColliderShape.d.ts +2 -2
package/dist/module.js
CHANGED
|
@@ -1,26 +1,4 @@
|
|
|
1
|
-
import { Ray, Vector3, Matrix, Quaternion, MathUtil, BoundingBox, BoundingSphere, CollisionUtil } from '@galacean/engine';
|
|
2
|
-
|
|
3
|
-
/******************************************************************************
|
|
4
|
-
Copyright (c) Microsoft Corporation.
|
|
5
|
-
|
|
6
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
-
purpose with or without fee is hereby granted.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
***************************************************************************** */
|
|
17
|
-
|
|
18
|
-
function __decorate(decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
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;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
}
|
|
1
|
+
import { Utils, Ray, Vector3, Matrix, Quaternion, MathUtil, BoundingBox, BoundingSphere, CollisionUtil } from '@galacean/engine';
|
|
24
2
|
|
|
25
3
|
function _set_prototype_of(o, p) {
|
|
26
4
|
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
@@ -66,22 +44,6 @@ function _instanceof(left, right) {
|
|
|
66
44
|
} else return left instanceof right;
|
|
67
45
|
}
|
|
68
46
|
|
|
69
|
-
/**
|
|
70
|
-
* Fastly remove an element from array.
|
|
71
|
-
* @param array - Array
|
|
72
|
-
* @param item - Element
|
|
73
|
-
*/ function removeFromArray(array, item) {
|
|
74
|
-
var index = array.indexOf(item);
|
|
75
|
-
if (index < 0) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
var last = array.length - 1;
|
|
79
|
-
if (index !== last) {
|
|
80
|
-
array[index] = array[last];
|
|
81
|
-
}
|
|
82
|
-
array.length--;
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
47
|
/**
|
|
86
48
|
* Used to update tags.
|
|
87
49
|
*/ var LiteUpdateFlag = /*#__PURE__*/ function() {
|
|
@@ -95,7 +57,7 @@ function _instanceof(left, right) {
|
|
|
95
57
|
/**
|
|
96
58
|
* Destroy.
|
|
97
59
|
*/ _proto.destroy = function destroy() {
|
|
98
|
-
removeFromArray(this._flags, this);
|
|
60
|
+
Utils.removeFromArray(this._flags, this);
|
|
99
61
|
this._flags = null;
|
|
100
62
|
};
|
|
101
63
|
return LiteUpdateFlag;
|
|
@@ -827,7 +789,7 @@ var /**
|
|
|
827
789
|
/**
|
|
828
790
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
829
791
|
*/ _proto.setWorldScale = function setWorldScale(scale) {
|
|
830
|
-
this._maxScale = Math.max(scale.x,
|
|
792
|
+
this._maxScale = Math.max(scale.x, scale.y, scale.z);
|
|
831
793
|
};
|
|
832
794
|
/**
|
|
833
795
|
* @internal
|
|
@@ -933,19 +895,17 @@ var /**
|
|
|
933
895
|
var curHit = LitePhysicsManager._currentHit;
|
|
934
896
|
for(var i = 0, len = colliders.length; i < len; i++){
|
|
935
897
|
var collider = colliders[i];
|
|
936
|
-
if (collider._raycast(ray, onRaycast, curHit)) {
|
|
898
|
+
if (collider._raycast(ray, onRaycast, curHit) && curHit.distance < distance) {
|
|
937
899
|
isHit = true;
|
|
938
|
-
if (
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
return true;
|
|
946
|
-
}
|
|
947
|
-
distance = curHit.distance;
|
|
900
|
+
if (hitResult) {
|
|
901
|
+
hitResult.normal.copyFrom(curHit.normal);
|
|
902
|
+
hitResult.point.copyFrom(curHit.point);
|
|
903
|
+
hitResult.distance = curHit.distance;
|
|
904
|
+
hitResult.shapeID = curHit.shapeID;
|
|
905
|
+
} else {
|
|
906
|
+
return true;
|
|
948
907
|
}
|
|
908
|
+
distance = curHit.distance;
|
|
949
909
|
}
|
|
950
910
|
}
|
|
951
911
|
if (!isHit && hitResult) {
|
|
@@ -1186,81 +1146,76 @@ var /**
|
|
|
1186
1146
|
return LiteStaticCollider;
|
|
1187
1147
|
}(LiteCollider);
|
|
1188
1148
|
|
|
1189
|
-
/**
|
|
1190
|
-
* Static interface implement decorator.
|
|
1191
|
-
* https://stackoverflow.com/questions/13955157/how-to-define-static-property-in-typescript-interface
|
|
1192
|
-
*/ function StaticInterfaceImplement() {
|
|
1193
|
-
return function(constructor) {
|
|
1194
|
-
};
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
1149
|
var LitePhysics = /*#__PURE__*/ function() {
|
|
1198
1150
|
function LitePhysics() {}
|
|
1151
|
+
var _proto = LitePhysics.prototype;
|
|
1152
|
+
/**
|
|
1153
|
+
* {@inheritDoc IPhysics.initialize }
|
|
1154
|
+
*/ _proto.initialize = function initialize() {
|
|
1155
|
+
return Promise.resolve();
|
|
1156
|
+
};
|
|
1199
1157
|
/**
|
|
1200
1158
|
* {@inheritDoc IPhysics.createPhysicsManager }
|
|
1201
|
-
*/
|
|
1159
|
+
*/ _proto.createPhysicsManager = function createPhysicsManager(onContactBegin, onContactEnd, onContactPersist, onTriggerBegin, onTriggerEnd, onTriggerPersist) {
|
|
1202
1160
|
return new LitePhysicsManager(onContactBegin, onContactEnd, onContactPersist, onTriggerBegin, onTriggerEnd, onTriggerPersist);
|
|
1203
1161
|
};
|
|
1204
1162
|
/**
|
|
1205
1163
|
* {@inheritDoc IPhysics.createStaticCollider }
|
|
1206
|
-
*/
|
|
1164
|
+
*/ _proto.createStaticCollider = function createStaticCollider(position, rotation) {
|
|
1207
1165
|
return new LiteStaticCollider(position, rotation);
|
|
1208
1166
|
};
|
|
1209
1167
|
/**
|
|
1210
1168
|
* {@inheritDoc IPhysics.createDynamicCollider }
|
|
1211
|
-
*/
|
|
1169
|
+
*/ _proto.createDynamicCollider = function createDynamicCollider(position, rotation) {
|
|
1212
1170
|
return new LiteDynamicCollider(position, rotation);
|
|
1213
1171
|
};
|
|
1214
1172
|
/**
|
|
1215
1173
|
* {@inheritDoc IPhysics.createCharacterController }
|
|
1216
|
-
*/
|
|
1174
|
+
*/ _proto.createCharacterController = function createCharacterController() {
|
|
1217
1175
|
throw "Physics-lite don't support createCharacterController. Use Physics-PhysX instead!";
|
|
1218
1176
|
};
|
|
1219
1177
|
/**
|
|
1220
1178
|
* {@inheritDoc IPhysics.createPhysicsMaterial }
|
|
1221
|
-
*/
|
|
1179
|
+
*/ _proto.createPhysicsMaterial = function createPhysicsMaterial(staticFriction, dynamicFriction, bounciness, frictionCombine, bounceCombine) {
|
|
1222
1180
|
return new LitePhysicsMaterial(staticFriction, dynamicFriction, bounciness, frictionCombine, bounceCombine);
|
|
1223
1181
|
};
|
|
1224
1182
|
/**
|
|
1225
1183
|
* {@inheritDoc IPhysics.createBoxColliderShape }
|
|
1226
|
-
*/
|
|
1184
|
+
*/ _proto.createBoxColliderShape = function createBoxColliderShape(uniqueID, size, material) {
|
|
1227
1185
|
return new LiteBoxColliderShape(uniqueID, size, material);
|
|
1228
1186
|
};
|
|
1229
1187
|
/**
|
|
1230
1188
|
* {@inheritDoc IPhysics.createSphereColliderShape }
|
|
1231
|
-
*/
|
|
1189
|
+
*/ _proto.createSphereColliderShape = function createSphereColliderShape(uniqueID, radius, material) {
|
|
1232
1190
|
return new LiteSphereColliderShape(uniqueID, radius, material);
|
|
1233
1191
|
};
|
|
1234
1192
|
/**
|
|
1235
1193
|
* {@inheritDoc IPhysics.createPlaneColliderShape }
|
|
1236
|
-
*/
|
|
1194
|
+
*/ _proto.createPlaneColliderShape = function createPlaneColliderShape(uniqueID, material) {
|
|
1237
1195
|
throw "Physics-lite don't support PlaneColliderShape. Use Physics-PhysX instead!";
|
|
1238
1196
|
};
|
|
1239
1197
|
/**
|
|
1240
1198
|
* {@inheritDoc IPhysics.createCapsuleColliderShape }
|
|
1241
|
-
*/
|
|
1199
|
+
*/ _proto.createCapsuleColliderShape = function createCapsuleColliderShape(uniqueID, radius, height, material) {
|
|
1242
1200
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1243
1201
|
};
|
|
1244
1202
|
/**
|
|
1245
1203
|
* {@inheritDoc IPhysics.createFixedJoint }
|
|
1246
|
-
*/
|
|
1204
|
+
*/ _proto.createFixedJoint = function createFixedJoint(collider) {
|
|
1247
1205
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1248
1206
|
};
|
|
1249
1207
|
/**
|
|
1250
1208
|
* {@inheritDoc IPhysics.createHingeJoint }
|
|
1251
|
-
*/
|
|
1209
|
+
*/ _proto.createHingeJoint = function createHingeJoint(collider) {
|
|
1252
1210
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1253
1211
|
};
|
|
1254
1212
|
/**
|
|
1255
1213
|
* {@inheritDoc IPhysics.createSpringJoint }
|
|
1256
|
-
*/
|
|
1214
|
+
*/ _proto.createSpringJoint = function createSpringJoint(collider) {
|
|
1257
1215
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1258
1216
|
};
|
|
1259
1217
|
return LitePhysics;
|
|
1260
1218
|
}();
|
|
1261
|
-
LitePhysics = __decorate([
|
|
1262
|
-
StaticInterfaceImplement()
|
|
1263
|
-
], LitePhysics);
|
|
1264
1219
|
|
|
1265
1220
|
export { LitePhysics };
|
|
1266
1221
|
//# sourceMappingURL=module.js.map
|