@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/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;
|
|
@@ -831,7 +793,7 @@
|
|
|
831
793
|
/**
|
|
832
794
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
833
795
|
*/ _proto.setWorldScale = function setWorldScale(scale) {
|
|
834
|
-
this._maxScale = Math.max(scale.x,
|
|
796
|
+
this._maxScale = Math.max(scale.x, scale.y, scale.z);
|
|
835
797
|
};
|
|
836
798
|
/**
|
|
837
799
|
* @internal
|
|
@@ -937,19 +899,17 @@
|
|
|
937
899
|
var curHit = LitePhysicsManager._currentHit;
|
|
938
900
|
for(var i = 0, len = colliders.length; i < len; i++){
|
|
939
901
|
var collider = colliders[i];
|
|
940
|
-
if (collider._raycast(ray, onRaycast, curHit)) {
|
|
902
|
+
if (collider._raycast(ray, onRaycast, curHit) && curHit.distance < distance) {
|
|
941
903
|
isHit = true;
|
|
942
|
-
if (
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
return true;
|
|
950
|
-
}
|
|
951
|
-
distance = curHit.distance;
|
|
904
|
+
if (hitResult) {
|
|
905
|
+
hitResult.normal.copyFrom(curHit.normal);
|
|
906
|
+
hitResult.point.copyFrom(curHit.point);
|
|
907
|
+
hitResult.distance = curHit.distance;
|
|
908
|
+
hitResult.shapeID = curHit.shapeID;
|
|
909
|
+
} else {
|
|
910
|
+
return true;
|
|
952
911
|
}
|
|
912
|
+
distance = curHit.distance;
|
|
953
913
|
}
|
|
954
914
|
}
|
|
955
915
|
if (!isHit && hitResult) {
|
|
@@ -1190,81 +1150,78 @@
|
|
|
1190
1150
|
return LiteStaticCollider;
|
|
1191
1151
|
}(LiteCollider);
|
|
1192
1152
|
|
|
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() {
|
|
1153
|
+
var LitePhysics = /*#__PURE__*/ function() {
|
|
1202
1154
|
function LitePhysics() {}
|
|
1155
|
+
var _proto = LitePhysics.prototype;
|
|
1156
|
+
/**
|
|
1157
|
+
* {@inheritDoc IPhysics.initialize }
|
|
1158
|
+
*/ _proto.initialize = function initialize() {
|
|
1159
|
+
return Promise.resolve();
|
|
1160
|
+
};
|
|
1203
1161
|
/**
|
|
1204
1162
|
* {@inheritDoc IPhysics.createPhysicsManager }
|
|
1205
|
-
*/
|
|
1163
|
+
*/ _proto.createPhysicsManager = function createPhysicsManager(onContactBegin, onContactEnd, onContactPersist, onTriggerBegin, onTriggerEnd, onTriggerPersist) {
|
|
1206
1164
|
return new LitePhysicsManager(onContactBegin, onContactEnd, onContactPersist, onTriggerBegin, onTriggerEnd, onTriggerPersist);
|
|
1207
1165
|
};
|
|
1208
1166
|
/**
|
|
1209
1167
|
* {@inheritDoc IPhysics.createStaticCollider }
|
|
1210
|
-
*/
|
|
1168
|
+
*/ _proto.createStaticCollider = function createStaticCollider(position, rotation) {
|
|
1211
1169
|
return new LiteStaticCollider(position, rotation);
|
|
1212
1170
|
};
|
|
1213
1171
|
/**
|
|
1214
1172
|
* {@inheritDoc IPhysics.createDynamicCollider }
|
|
1215
|
-
*/
|
|
1173
|
+
*/ _proto.createDynamicCollider = function createDynamicCollider(position, rotation) {
|
|
1216
1174
|
return new LiteDynamicCollider(position, rotation);
|
|
1217
1175
|
};
|
|
1218
1176
|
/**
|
|
1219
1177
|
* {@inheritDoc IPhysics.createCharacterController }
|
|
1220
|
-
*/
|
|
1178
|
+
*/ _proto.createCharacterController = function createCharacterController() {
|
|
1221
1179
|
throw "Physics-lite don't support createCharacterController. Use Physics-PhysX instead!";
|
|
1222
1180
|
};
|
|
1223
1181
|
/**
|
|
1224
1182
|
* {@inheritDoc IPhysics.createPhysicsMaterial }
|
|
1225
|
-
*/
|
|
1183
|
+
*/ _proto.createPhysicsMaterial = function createPhysicsMaterial(staticFriction, dynamicFriction, bounciness, frictionCombine, bounceCombine) {
|
|
1226
1184
|
return new LitePhysicsMaterial(staticFriction, dynamicFriction, bounciness, frictionCombine, bounceCombine);
|
|
1227
1185
|
};
|
|
1228
1186
|
/**
|
|
1229
1187
|
* {@inheritDoc IPhysics.createBoxColliderShape }
|
|
1230
|
-
*/
|
|
1188
|
+
*/ _proto.createBoxColliderShape = function createBoxColliderShape(uniqueID, size, material) {
|
|
1231
1189
|
return new LiteBoxColliderShape(uniqueID, size, material);
|
|
1232
1190
|
};
|
|
1233
1191
|
/**
|
|
1234
1192
|
* {@inheritDoc IPhysics.createSphereColliderShape }
|
|
1235
|
-
*/
|
|
1193
|
+
*/ _proto.createSphereColliderShape = function createSphereColliderShape(uniqueID, radius, material) {
|
|
1236
1194
|
return new LiteSphereColliderShape(uniqueID, radius, material);
|
|
1237
1195
|
};
|
|
1238
1196
|
/**
|
|
1239
1197
|
* {@inheritDoc IPhysics.createPlaneColliderShape }
|
|
1240
|
-
*/
|
|
1198
|
+
*/ _proto.createPlaneColliderShape = function createPlaneColliderShape(uniqueID, material) {
|
|
1241
1199
|
throw "Physics-lite don't support PlaneColliderShape. Use Physics-PhysX instead!";
|
|
1242
1200
|
};
|
|
1243
1201
|
/**
|
|
1244
1202
|
* {@inheritDoc IPhysics.createCapsuleColliderShape }
|
|
1245
|
-
*/
|
|
1203
|
+
*/ _proto.createCapsuleColliderShape = function createCapsuleColliderShape(uniqueID, radius, height, material) {
|
|
1246
1204
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1247
1205
|
};
|
|
1248
1206
|
/**
|
|
1249
1207
|
* {@inheritDoc IPhysics.createFixedJoint }
|
|
1250
|
-
*/
|
|
1208
|
+
*/ _proto.createFixedJoint = function createFixedJoint(collider) {
|
|
1251
1209
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1252
1210
|
};
|
|
1253
1211
|
/**
|
|
1254
1212
|
* {@inheritDoc IPhysics.createHingeJoint }
|
|
1255
|
-
*/
|
|
1213
|
+
*/ _proto.createHingeJoint = function createHingeJoint(collider) {
|
|
1256
1214
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1257
1215
|
};
|
|
1258
1216
|
/**
|
|
1259
1217
|
* {@inheritDoc IPhysics.createSpringJoint }
|
|
1260
|
-
*/
|
|
1218
|
+
*/ _proto.createSpringJoint = function createSpringJoint(collider) {
|
|
1261
1219
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1262
1220
|
};
|
|
1263
1221
|
return LitePhysics;
|
|
1264
1222
|
}();
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
], exports.LitePhysics);
|
|
1223
|
+
|
|
1224
|
+
exports.LitePhysics = LitePhysics;
|
|
1268
1225
|
|
|
1269
1226
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1270
1227
|
|
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,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],i):i(((t="undefined"!=typeof globalThis?globalThis:t||self).Galacean=t.Galacean||{},t.Galacean.PhysicsLite={}),t.Galacean)}(this,function(t,i){"use strict";function e(t,i){return(e=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t})(t,i)}function n(t,i){if("function"!=typeof i&&null!==i)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),i&&e(t,i)}function s(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,i,e){return i&&s(t.prototype,i),e&&s(t,e),t}function r(t,i){return null!=i&&"undefined"!=typeof Symbol&&i[Symbol.hasInstance]?!!i[Symbol.hasInstance](t):t instanceof i}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(){i.Utils.removeFromArray(this._flags,this),this._flags=null},t}(),d=function(){function t(){this._updateFlags=[]}var i=t.prototype;return i.register=function(){return new u(this._updateFlags)},i.distribute=function(){for(var t=this._updateFlags,i=t.length-1;i>=0;i--)t[i].flag=!0},t}(),_=function(){function t(){this._transform=new p,this._invModelMatrix=new i.Matrix,this._transform.owner=this,this._inverseWorldMatFlag=this._transform.registerWorldChangeFlag()}var e=t.prototype;return e.setRotation=function(t){console.log("Physics-lite don't support setRotation. Use Physics-PhysX instead!")},e.setPosition=function(t){this._transform.setPosition(t.x,t.y,t.z)},e.setContactOffset=function(t){console.log("Physics-lite don't support setContactOffset. Use Physics-PhysX instead!")},e.setMaterial=function(t){console.log("Physics-lite don't support setMaterial. Use Physics-PhysX instead!")},e.setUniqueID=function(t){this._id=t},e.setIsTrigger=function(t){console.log("Physics-lite don't support setIsTrigger. Use Physics-PhysX instead!")},e.destroy=function(){},e._updateHitResult=function(e,n,s,o,r){void 0===r&&(r=!1);var a=t._tempPoint;e.getPoint(n,a),r||i.Vector3.transformCoordinate(a,this._transform.worldMatrix,a);var h=i.Vector3.distance(o,a);h<s.distance&&(s.point.copyFrom(a),s.distance=h,s.shapeID=this._id)},e._getLocalRay=function(e){var n=this._getInvModelMatrix(),s=t._ray;return i.Vector3.transformCoordinate(e.origin,n,s.origin),i.Vector3.transformNormal(e.direction,n,s.direction),s.direction.normalize(),s},e._getInvModelMatrix=function(){return this._inverseWorldMatFlag.flag&&(i.Matrix.invert(this._transform.worldMatrix,this._invModelMatrix),this._inverseWorldMatFlag.flag=!1),this._invModelMatrix},t}();_._ray=new i.Ray,_._tempPoint=new i.Vector3;var p=function(){function t(){this._position=new i.Vector3,this._rotation=new i.Vector3,this._rotationQuaternion=new i.Quaternion,this._scale=new i.Vector3(1,1,1),this._worldRotationQuaternion=new i.Quaternion,this._localMatrix=new i.Matrix,this._worldMatrix=new i.Matrix,this._updateFlagManager=new d,this._isParentDirty=!0,this._parentTransformCache=null,this._dirtyFlag=188}var e=t.prototype;return e.setPosition=function(t,i,e){this._position.set(t,i,e),this.position=this._position},e.setRotationQuaternion=function(t,i,e,n){this._rotationQuaternion.set(t,i,e,n),this.rotationQuaternion=this._rotationQuaternion},e.setScale=function(t,i,e){this._scale.set(t,i,e),this.scale=this._scale},e.registerWorldChangeFlag=function(){return this._updateFlagManager.register()},e._updateWorldPositionFlag=function(){if(!this._isContainDirtyFlags(132)&&(this._worldAssociatedChange(132),r(this._owner,f)))for(var t=this._owner._shapes,i=0,e=t.length;i<e;i++)t[i]._transform._updateWorldPositionFlag()},e._updateWorldRotationFlag=function(){if(!this._isContainDirtyFlags(152)&&(this._worldAssociatedChange(152),r(this._owner,f)))for(var t=this._owner._shapes,i=0,e=t.length;i<e;i++)t[i]._transform._updateWorldRotationFlag()},e._updateWorldScaleFlag=function(){if(!this._isContainDirtyFlags(160)&&(this._worldAssociatedChange(160),r(this._owner,f)))for(var t=this._owner._shapes,i=0,e=t.length;i<e;i++)t[i]._transform._updateWorldScaleFlag()},e._updateAllWorldFlag=function(){if(!this._isContainDirtyFlags(188)&&(this._worldAssociatedChange(188),r(this._owner,f)))for(var t=this._owner._shapes,i=0,e=t.length;i<e;i++)t[i]._transform._updateAllWorldFlag()},e._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},e._isContainDirtyFlags=function(t){return(this._dirtyFlag&t)===t},e._isContainDirtyFlag=function(t){return(this._dirtyFlag&t)!=0},e._setDirtyFlagTrue=function(t){this._dirtyFlag|=t},e._setDirtyFlagFalse=function(t){this._dirtyFlag&=~t},e._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)&&(i.Quaternion.rotationEuler(i.MathUtil.degreeToRadian(this._rotation.x),i.MathUtil.degreeToRadian(this._rotation.y),i.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?i.Quaternion.multiply(t.worldRotationQuaternion,this.rotationQuaternion,this._worldRotationQuaternion):this._worldRotationQuaternion.copyFrom(this.rotationQuaternion),this._setDirtyFlagFalse(16)}return this._worldRotationQuaternion},set:function(e){this._worldRotationQuaternion!==e&&this._worldRotationQuaternion.copyFrom(e);var n=this._getParentTransform();n?(i.Quaternion.invert(n.worldRotationQuaternion,t._tempQuat0),i.Quaternion.multiply(e,t._tempQuat0,this._rotationQuaternion)):this._rotationQuaternion.copyFrom(e),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)&&(i.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?i.Matrix.multiply(t.worldMatrix,this.localMatrix,this._worldMatrix):this._worldMatrix.copyFrom(this.localMatrix),this._setDirtyFlagFalse(128)}return this._worldMatrix},set:function(e){this._worldMatrix!==e&&this._worldMatrix.copyFrom(e);var n=this._getParentTransform();n?(i.Matrix.invert(n.worldMatrix,t._tempMat42),i.Matrix.multiply(t._tempMat42,e,this._localMatrix)):this._localMatrix.copyFrom(e),this.localMatrix=this._localMatrix,this._setDirtyFlagFalse(128)}}]),t}();p._tempQuat0=new i.Quaternion,p._tempMat42=new i.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 i=t.prototype;return i.addShape=function(t){var i=t._collider;i!==this&&(i&&i.removeShape(t),this._shapes.push(t),t._collider=this)},i.removeShape=function(t){var i=this._shapes.indexOf(t);-1!==i&&(this._shapes.splice(i,1),t._collider=null)},i.setWorldTransform=function(t,i){this._transform.setPosition(t.x,t.y,t.z),this._transform.setRotationQuaternion(i.x,i.y,i.z,i.w)},i.getWorldTransform=function(t,i){var e=this._transform,n=e.position,s=e.rotationQuaternion;t.set(n.x,n.y,n.z),i.set(s.x,s.y,s.z,s.w)},i.destroy=function(){},i._raycast=function(t,i,e){e.distance=Number.MAX_VALUE;for(var n=this._shapes,s=0,o=n.length;s<o;s++){var r=n[s];i(r._id)&&r._raycast(t,e)}return e.distance!=Number.MAX_VALUE},t}(),y=function(t){function i(i,e){var n;return(n=t.call(this)||this)._transform.setPosition(i.x,i.y,i.z),n._transform.setRotationQuaternion(e.x,e.y,e.z,e.w),n}n(i,t);var e=i.prototype;return e.addForce=function(t){throw"Physics-lite don't support addForce. Use Physics-PhysX instead!"},e.addTorque=function(t){throw"Physics-lite don't support addTorque. Use Physics-PhysX instead!"},e.move=function(t,i){throw"Physics-lite don't support move. Use Physics-PhysX instead!"},e.sleep=function(){throw"Physics-lite don't support putToSleep. Use Physics-PhysX instead!"},e.setAngularDamping=function(t){throw"Physics-lite don't support setAngularDamping. Use Physics-PhysX instead!"},e.setAngularVelocity=function(t){throw"Physics-lite don't support setAngularVelocity. Use Physics-PhysX instead!"},e.setCenterOfMass=function(t){throw"Physics-lite don't support setCenterOfMass. Use Physics-PhysX instead!"},e.setCollisionDetectionMode=function(t){throw"Physics-lite don't support setCollisionDetectionMode. Use Physics-PhysX instead!"},e.setConstraints=function(t){throw"Physics-lite don't support setConstraints. Use Physics-PhysX instead!"},e.setInertiaTensor=function(t){throw"Physics-lite don't support setInertiaTensor. Use Physics-PhysX instead!"},e.setIsKinematic=function(t){throw"Physics-lite don't support setIsKinematic. Use Physics-PhysX instead!"},e.setLinearDamping=function(t){throw"Physics-lite don't support setLinearDamping. Use Physics-PhysX instead!"},e.setLinearVelocity=function(t){throw"Physics-lite don't support setLinearVelocity. Use Physics-PhysX instead!"},e.setMass=function(t){throw"Physics-lite don't support setMass. Use Physics-PhysX instead!"},e.setMaxAngularVelocity=function(t){throw"Physics-lite don't support setMaxAngularVelocity. Use Physics-PhysX instead!"},e.setMaxDepenetrationVelocity=function(t){throw"Physics-lite don't support setMaxDepenetrationVelocity. Use Physics-PhysX instead!"},e.setSleepThreshold=function(t){throw"Physics-lite don't support setSleepThreshold. Use Physics-PhysX instead!"},e.setSolverIterations=function(t){throw"Physics-lite don't support setSolverIterations. Use Physics-PhysX instead!"},e.wakeUp=function(){throw"Physics-lite don't support wakeUp. Use Physics-PhysX instead!"},i}(f),g=function(){function t(t){void 0===t&&(t=0),this.length=0,this._elements=Array(t)}var i=t.prototype;return i.add=function(t){this.length===this._elements.length?this._elements.push(t):this._elements[this.length]=t,this.length++},i.delete=function(t){var i=this._elements.indexOf(t);this.deleteByIndex(i)},i.get=function(t){if(t>=this.length)throw"Index is out of range.";return this._elements[t]},i.deleteByIndex=function(t){var i=this._elements,e=null,n=this.length-1;return t!==n&&(e=i[n],i[t]=e),this.length--,e},i.garbageCollection=function(){this._elements.length=this.length},t}(),m=function(){this.shapeID=-1,this.distance=0,this.point=new i.Vector3,this.normal=new i.Vector3},P=function(t){function e(e,n,s){var o;return(o=t.call(this)||this)._halfSize=new i.Vector3,o._scale=new i.Vector3(1,1,1),o._boxMin=new i.Vector3(-.5,-.5,-.5),o._boxMax=new i.Vector3(.5,.5,.5),o._id=e,o._halfSize.set(.5*n.x,.5*n.y,.5*n.z),o._setBondingBox(),o}n(e,t);var s=e.prototype;return s.setPosition=function(i){t.prototype.setPosition.call(this,i),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,i){var n=this._getLocalRay(t),s=e._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,i,t.origin),!0)},s._setBondingBox=function(){var t=this._transform.position,e=this._halfSize;i.Vector3.add(t,e,this._boxMax),i.Vector3.subtract(t,e,this._boxMin)},e}(_);P._tempBox=new i.BoundingBox;var x=function(t){function e(i,e,n){var s;return(s=t.call(this)||this)._radius=1,s._maxScale=1,s._radius=e,s._id=i,s}n(e,t);var s=e.prototype;return s.setRadius=function(t){this._radius=t},s.setWorldScale=function(t){this._maxScale=Math.max(t.x,t.y,t.z)},s._raycast=function(t,n){var s=e._tempSphere;i.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(e,[{key:"worldRadius",get:function(){return this._radius*this._maxScale}}]),e}(_);x._tempSphere=new i.BoundingSphere;var v=function(){function t(t,e,n,s,o,r){this._colliders=[],this._sphere=new i.BoundingSphere,this._box=new i.BoundingBox,this._currentEvents=new g,this._eventMap={},this._eventPool=[],this._onContactEnter=t,this._onContactExit=e,this._onContactStay=n,this._onTriggerEnter=s,this._onTriggerExit=o,this._onTriggerStay=r}var e=t.prototype;return e.setGravity=function(t){console.log("Physics-lite don't support gravity. Use Physics-PhysX instead!")},e.addColliderShape=function(t){this._eventMap[t._id]={}},e.removeColliderShape=function(t){for(var i=this._eventPool,e=this._currentEvents,n=t._id,s=e.length-1;s>=0;s--){var o=e.get(s);(o.index1==n||o.index2==n)&&(e.deleteByIndex(s),i.push(o))}delete this._eventMap[n]},e.addCollider=function(t){this._colliders.push(t)},e.removeCollider=function(t){var i=this._colliders.indexOf(t);-1!==i&&this._colliders.splice(i,1)},e.update=function(t){for(var i=this._colliders,e=0,n=i.length;e<n;e++)this._collisionDetection(t,i[e]);this._fireEvent()},e.raycast=function(i,e,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(i,n,h)&&h.distance<e){if(a=!0,!o)return!0;o.normal.copyFrom(h.normal),o.point.copyFrom(h.point),o.distance=h.distance,o.shapeID=h.shapeID,e=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},e.addCharacterController=function(t){throw"Physics-lite don't support addCharacterController. Use Physics-PhysX instead!"},e.removeCharacterController=function(t){throw"Physics-lite don't support removeCharacterController. Use Physics-PhysX instead!"},e._getTrigger=function(t,i){var e;return this._eventPool.length?((e=this._eventPool.pop()).index1=t,e.index2=i):e=new w(t,i),this._eventMap[t][i]=e,e},e._collisionDetection=function(i,e){for(var n=this._colliders,s=e._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)}}}}},e._fireEvent=function(){for(var t=this._eventPool,i=this._currentEvents,e=i.length-1;e>=0;e--){var n=i.get(e);n.alreadyInvoked?(n.state=2,this._eventMap[n.index1][n.index2]=void 0,this._onTriggerExit(n.index1,n.index2),i.deleteByIndex(e),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)}},e._boxCollision=function(e){if(r(e,P)){var n=t._tempBox;return t._updateWorldBox(e,n),i.CollisionUtil.intersectsBoxAndBox(n,this._box)}if(r(e,x)){var s=t._tempSphere;return t._upWorldSphere(e,s),i.CollisionUtil.intersectsSphereAndBox(s,this._box)}return!1},e._sphereCollision=function(e){if(r(e,P)){var n=t._tempBox;return t._updateWorldBox(e,n),i.CollisionUtil.intersectsSphereAndBox(this._sphere,n)}if(r(e,x)){var s=t._tempSphere;return t._upWorldSphere(e,s),i.CollisionUtil.intersectsSphereAndSphere(s,this._sphere)}return!1},t._updateWorldBox=function(t,e){var n=t._transform.worldMatrix;e.min.copyFrom(t._boxMin),e.max.copyFrom(t._boxMax),i.BoundingBox.transform(e,n,e)},t._upWorldSphere=function(t,e){i.Vector3.transformCoordinate(t._transform.position,t._transform.worldMatrix,e.center),e.radius=t.worldRadius},t}();v._tempSphere=new i.BoundingSphere,v._tempBox=new i.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,i){this.alreadyInvoked=!1,this.index1=t,this.index2=i},M=function(){function t(t,i,e,n,s){}var i=t.prototype;return i.setBounciness=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},i.setDynamicFriction=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},i.setStaticFriction=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},i.setBounceCombine=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},i.setFrictionCombine=function(t){throw"Physics-lite don't support physics material. Use Physics-PhysX instead!"},i.destroy=function(){},t}(),F=function(t){function i(i,e){var n;return(n=t.call(this)||this)._transform.setPosition(i.x,i.y,i.z),n._transform.setRotationQuaternion(e.x,e.y,e.z,e.w),n}return n(i,t),i}(f),C=function(){function t(){}var i=t.prototype;return i.initialize=function(){return Promise.resolve()},i.createPhysicsManager=function(t,i,e,n,s,o){return new v(t,i,e,n,s,o)},i.createStaticCollider=function(t,i){return new F(t,i)},i.createDynamicCollider=function(t,i){return new y(t,i)},i.createCharacterController=function(){throw"Physics-lite don't support createCharacterController. Use Physics-PhysX instead!"},i.createPhysicsMaterial=function(t,i,e,n,s){return new M(t,i,e,n,s)},i.createBoxColliderShape=function(t,i,e){return new P(t,i,e)},i.createSphereColliderShape=function(t,i,e){return new x(t,i,e)},i.createPlaneColliderShape=function(t,i){throw"Physics-lite don't support PlaneColliderShape. Use Physics-PhysX instead!"},i.createCapsuleColliderShape=function(t,i,e,n){throw"Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!"},i.createFixedJoint=function(t){throw"Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!"},i.createHingeJoint=function(t){throw"Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!"},i.createSpringJoint=function(t){throw"Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!"},t}();t.LitePhysics=C,Object.defineProperty(t,"__esModule",{value:!0})});
|
package/dist/main.js
CHANGED
|
@@ -4,28 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var engine = require('@galacean/engine');
|
|
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 @@ function _instanceof(left, right) {
|
|
|
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 @@ function _instanceof(left, right) {
|
|
|
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;
|
|
@@ -831,7 +793,7 @@ var /**
|
|
|
831
793
|
/**
|
|
832
794
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
833
795
|
*/ _proto.setWorldScale = function setWorldScale(scale) {
|
|
834
|
-
this._maxScale = Math.max(scale.x,
|
|
796
|
+
this._maxScale = Math.max(scale.x, scale.y, scale.z);
|
|
835
797
|
};
|
|
836
798
|
/**
|
|
837
799
|
* @internal
|
|
@@ -937,19 +899,17 @@ var /**
|
|
|
937
899
|
var curHit = LitePhysicsManager._currentHit;
|
|
938
900
|
for(var i = 0, len = colliders.length; i < len; i++){
|
|
939
901
|
var collider = colliders[i];
|
|
940
|
-
if (collider._raycast(ray, onRaycast, curHit)) {
|
|
902
|
+
if (collider._raycast(ray, onRaycast, curHit) && curHit.distance < distance) {
|
|
941
903
|
isHit = true;
|
|
942
|
-
if (
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
return true;
|
|
950
|
-
}
|
|
951
|
-
distance = curHit.distance;
|
|
904
|
+
if (hitResult) {
|
|
905
|
+
hitResult.normal.copyFrom(curHit.normal);
|
|
906
|
+
hitResult.point.copyFrom(curHit.point);
|
|
907
|
+
hitResult.distance = curHit.distance;
|
|
908
|
+
hitResult.shapeID = curHit.shapeID;
|
|
909
|
+
} else {
|
|
910
|
+
return true;
|
|
952
911
|
}
|
|
912
|
+
distance = curHit.distance;
|
|
953
913
|
}
|
|
954
914
|
}
|
|
955
915
|
if (!isHit && hitResult) {
|
|
@@ -1190,79 +1150,76 @@ var /**
|
|
|
1190
1150
|
return LiteStaticCollider;
|
|
1191
1151
|
}(LiteCollider);
|
|
1192
1152
|
|
|
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() {
|
|
1153
|
+
var LitePhysics = /*#__PURE__*/ function() {
|
|
1202
1154
|
function LitePhysics() {}
|
|
1155
|
+
var _proto = LitePhysics.prototype;
|
|
1156
|
+
/**
|
|
1157
|
+
* {@inheritDoc IPhysics.initialize }
|
|
1158
|
+
*/ _proto.initialize = function initialize() {
|
|
1159
|
+
return Promise.resolve();
|
|
1160
|
+
};
|
|
1203
1161
|
/**
|
|
1204
1162
|
* {@inheritDoc IPhysics.createPhysicsManager }
|
|
1205
|
-
*/
|
|
1163
|
+
*/ _proto.createPhysicsManager = function createPhysicsManager(onContactBegin, onContactEnd, onContactPersist, onTriggerBegin, onTriggerEnd, onTriggerPersist) {
|
|
1206
1164
|
return new LitePhysicsManager(onContactBegin, onContactEnd, onContactPersist, onTriggerBegin, onTriggerEnd, onTriggerPersist);
|
|
1207
1165
|
};
|
|
1208
1166
|
/**
|
|
1209
1167
|
* {@inheritDoc IPhysics.createStaticCollider }
|
|
1210
|
-
*/
|
|
1168
|
+
*/ _proto.createStaticCollider = function createStaticCollider(position, rotation) {
|
|
1211
1169
|
return new LiteStaticCollider(position, rotation);
|
|
1212
1170
|
};
|
|
1213
1171
|
/**
|
|
1214
1172
|
* {@inheritDoc IPhysics.createDynamicCollider }
|
|
1215
|
-
*/
|
|
1173
|
+
*/ _proto.createDynamicCollider = function createDynamicCollider(position, rotation) {
|
|
1216
1174
|
return new LiteDynamicCollider(position, rotation);
|
|
1217
1175
|
};
|
|
1218
1176
|
/**
|
|
1219
1177
|
* {@inheritDoc IPhysics.createCharacterController }
|
|
1220
|
-
*/
|
|
1178
|
+
*/ _proto.createCharacterController = function createCharacterController() {
|
|
1221
1179
|
throw "Physics-lite don't support createCharacterController. Use Physics-PhysX instead!";
|
|
1222
1180
|
};
|
|
1223
1181
|
/**
|
|
1224
1182
|
* {@inheritDoc IPhysics.createPhysicsMaterial }
|
|
1225
|
-
*/
|
|
1183
|
+
*/ _proto.createPhysicsMaterial = function createPhysicsMaterial(staticFriction, dynamicFriction, bounciness, frictionCombine, bounceCombine) {
|
|
1226
1184
|
return new LitePhysicsMaterial(staticFriction, dynamicFriction, bounciness, frictionCombine, bounceCombine);
|
|
1227
1185
|
};
|
|
1228
1186
|
/**
|
|
1229
1187
|
* {@inheritDoc IPhysics.createBoxColliderShape }
|
|
1230
|
-
*/
|
|
1188
|
+
*/ _proto.createBoxColliderShape = function createBoxColliderShape(uniqueID, size, material) {
|
|
1231
1189
|
return new LiteBoxColliderShape(uniqueID, size, material);
|
|
1232
1190
|
};
|
|
1233
1191
|
/**
|
|
1234
1192
|
* {@inheritDoc IPhysics.createSphereColliderShape }
|
|
1235
|
-
*/
|
|
1193
|
+
*/ _proto.createSphereColliderShape = function createSphereColliderShape(uniqueID, radius, material) {
|
|
1236
1194
|
return new LiteSphereColliderShape(uniqueID, radius, material);
|
|
1237
1195
|
};
|
|
1238
1196
|
/**
|
|
1239
1197
|
* {@inheritDoc IPhysics.createPlaneColliderShape }
|
|
1240
|
-
*/
|
|
1198
|
+
*/ _proto.createPlaneColliderShape = function createPlaneColliderShape(uniqueID, material) {
|
|
1241
1199
|
throw "Physics-lite don't support PlaneColliderShape. Use Physics-PhysX instead!";
|
|
1242
1200
|
};
|
|
1243
1201
|
/**
|
|
1244
1202
|
* {@inheritDoc IPhysics.createCapsuleColliderShape }
|
|
1245
|
-
*/
|
|
1203
|
+
*/ _proto.createCapsuleColliderShape = function createCapsuleColliderShape(uniqueID, radius, height, material) {
|
|
1246
1204
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1247
1205
|
};
|
|
1248
1206
|
/**
|
|
1249
1207
|
* {@inheritDoc IPhysics.createFixedJoint }
|
|
1250
|
-
*/
|
|
1208
|
+
*/ _proto.createFixedJoint = function createFixedJoint(collider) {
|
|
1251
1209
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1252
1210
|
};
|
|
1253
1211
|
/**
|
|
1254
1212
|
* {@inheritDoc IPhysics.createHingeJoint }
|
|
1255
|
-
*/
|
|
1213
|
+
*/ _proto.createHingeJoint = function createHingeJoint(collider) {
|
|
1256
1214
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1257
1215
|
};
|
|
1258
1216
|
/**
|
|
1259
1217
|
* {@inheritDoc IPhysics.createSpringJoint }
|
|
1260
|
-
*/
|
|
1218
|
+
*/ _proto.createSpringJoint = function createSpringJoint(collider) {
|
|
1261
1219
|
throw "Physics-lite don't support CapsuleColliderShape. Use Physics-PhysX instead!";
|
|
1262
1220
|
};
|
|
1263
1221
|
return LitePhysics;
|
|
1264
1222
|
}();
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
], exports.LitePhysics);
|
|
1223
|
+
|
|
1224
|
+
exports.LitePhysics = LitePhysics;
|
|
1268
1225
|
//# sourceMappingURL=main.js.map
|