@galacean/engine-physics-physx 2.0.0-alpha.32 → 2.0.0-alpha.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +46 -37
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/main.js +46 -37
- package/dist/main.js.map +1 -1
- package/dist/module.js +46 -37
- package/dist/module.js.map +1 -1
- package/libs/physx.release.js +1 -1
- package/libs/physx.release.simd.js +1 -1
- package/libs/physx.release.simd.wasm +0 -0
- package/libs/physx.release.wasm +0 -0
- package/package.json +4 -4
- package/types/PhysXPhysicsScene.d.ts +4 -0
package/dist/module.js
CHANGED
|
@@ -845,6 +845,7 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
845
845
|
this._boxGeometry = null;
|
|
846
846
|
this._sphereGeometry = null;
|
|
847
847
|
this._capsuleGeometry = null;
|
|
848
|
+
this._currentOnQuery = null;
|
|
848
849
|
this._activeTriggers = new DisorderedArray();
|
|
849
850
|
this._contactEvents = [];
|
|
850
851
|
this._contactEventCount = 0;
|
|
@@ -859,8 +860,11 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
859
860
|
this._physXManager = physicsManager;
|
|
860
861
|
var physX = physXPhysics._physX;
|
|
861
862
|
this._pxRaycastHit = new physX.PxRaycastHit();
|
|
863
|
+
this._pxSweepHit = new physX.PxSweepHit();
|
|
862
864
|
this._pxFilterData = new physX.PxQueryFilterData();
|
|
863
865
|
this._pxFilterData.flags = new physX.PxQueryFlags(1 | 2 | 4);
|
|
866
|
+
this._pxRaycastSweepFilterData = new physX.PxQueryFilterData();
|
|
867
|
+
this._pxRaycastSweepFilterData.flags = new physX.PxQueryFlags(1 | 2 | 4 | 8);
|
|
864
868
|
var triggerCallback = {
|
|
865
869
|
onContactBegin: function(collision) {
|
|
866
870
|
_this._bufferContactEvent(collision, 0);
|
|
@@ -895,6 +899,16 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
895
899
|
var sceneDesc = physX.getDefaultSceneDesc(pxPhysics.getTolerancesScale(), 0, this._physXSimulationCallbackInstance);
|
|
896
900
|
this._pxScene = pxPhysics.createScene(sceneDesc);
|
|
897
901
|
sceneDesc.delete();
|
|
902
|
+
this._pxQueryCallback = physX.PxQueryFilterCallback.implement({
|
|
903
|
+
preFilter: function(_filterData, index, _actor) {
|
|
904
|
+
return _this._currentOnQuery(index) ? 2 : 0;
|
|
905
|
+
},
|
|
906
|
+
// distance <= 0 means initial overlap — drop the hit so subsequent hits can be considered.
|
|
907
|
+
// Only invoked when the query's filter data includes POST_FILTER (raycast/sweep, not overlap).
|
|
908
|
+
postFilter: function(_filterData, distance) {
|
|
909
|
+
return distance <= 0 ? 0 : 2;
|
|
910
|
+
}
|
|
911
|
+
});
|
|
898
912
|
}
|
|
899
913
|
var _proto = PhysXPhysicsScene.prototype;
|
|
900
914
|
/**
|
|
@@ -983,18 +997,14 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
983
997
|
*/ _proto.raycast = function raycast(ray, distance, onRaycast, hit) {
|
|
984
998
|
var _this = this, pxHitResult = _this._pxRaycastHit;
|
|
985
999
|
distance = Math.min(distance, 3.4e38); // float32 max value limit in physX raycast.
|
|
986
|
-
var
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
};
|
|
995
|
-
var pxRaycastCallback = this._physXPhysics._physX.PxQueryFilterCallback.implement(raycastCallback);
|
|
996
|
-
var result = this._pxScene.raycastSingle(ray.origin, ray.direction, distance, pxHitResult, this._pxFilterData, pxRaycastCallback);
|
|
997
|
-
pxRaycastCallback.delete();
|
|
1000
|
+
var prevOnQuery = this._currentOnQuery;
|
|
1001
|
+
this._currentOnQuery = onRaycast;
|
|
1002
|
+
var result;
|
|
1003
|
+
try {
|
|
1004
|
+
result = this._pxScene.raycastSingle(ray.origin, ray.direction, distance, pxHitResult, this._pxRaycastSweepFilterData, this._pxQueryCallback);
|
|
1005
|
+
} finally{
|
|
1006
|
+
this._currentOnQuery = prevOnQuery;
|
|
1007
|
+
}
|
|
998
1008
|
if (result && hit != undefined) {
|
|
999
1009
|
var position = PhysXPhysicsScene._tempPosition, normal = PhysXPhysicsScene._tempNormal;
|
|
1000
1010
|
var pxPosition = pxHitResult.position, pxNormal = pxHitResult.normal;
|
|
@@ -1105,8 +1115,12 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
1105
1115
|
(_this__capsuleGeometry = this._capsuleGeometry) == null ? void 0 : _this__capsuleGeometry.delete();
|
|
1106
1116
|
this._physXSimulationCallbackInstance.delete();
|
|
1107
1117
|
this._pxRaycastHit.delete();
|
|
1118
|
+
this._pxSweepHit.delete();
|
|
1108
1119
|
this._pxFilterData.flags.delete();
|
|
1109
1120
|
this._pxFilterData.delete();
|
|
1121
|
+
this._pxRaycastSweepFilterData.flags.delete();
|
|
1122
|
+
this._pxRaycastSweepFilterData.delete();
|
|
1123
|
+
this._pxQueryCallback.delete();
|
|
1110
1124
|
(_this__pxControllerManager = this._pxControllerManager) == null ? void 0 : _this__pxControllerManager.release();
|
|
1111
1125
|
this._pxScene.release();
|
|
1112
1126
|
};
|
|
@@ -1143,19 +1157,16 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
1143
1157
|
delete eventMap[id];
|
|
1144
1158
|
};
|
|
1145
1159
|
_proto._sweepSingle = function _sweepSingle(geometry, pose, direction, distance, onSweep, outHitResult) {
|
|
1160
|
+
var _this = this, pxSweepHit = _this._pxSweepHit;
|
|
1146
1161
|
distance = Math.min(distance, 3.4e38); // float32 max value limit in physx sweep
|
|
1147
|
-
var
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
};
|
|
1156
|
-
var pxSweepCallback = this._physXPhysics._physX.PxQueryFilterCallback.implement(sweepCallback);
|
|
1157
|
-
var pxSweepHit = new this._physXPhysics._physX.PxSweepHit();
|
|
1158
|
-
var result = this._pxScene.sweepSingle(geometry, pose, direction, distance, pxSweepHit, this._pxFilterData, pxSweepCallback);
|
|
1162
|
+
var prevOnQuery = this._currentOnQuery;
|
|
1163
|
+
this._currentOnQuery = onSweep;
|
|
1164
|
+
var result;
|
|
1165
|
+
try {
|
|
1166
|
+
result = this._pxScene.sweepSingle(geometry, pose, direction, distance, pxSweepHit, this._pxRaycastSweepFilterData, this._pxQueryCallback);
|
|
1167
|
+
} finally{
|
|
1168
|
+
this._currentOnQuery = prevOnQuery;
|
|
1169
|
+
}
|
|
1159
1170
|
if (result && outHitResult != undefined) {
|
|
1160
1171
|
var position = PhysXPhysicsScene._tempPosition, normal = PhysXPhysicsScene._tempNormal;
|
|
1161
1172
|
var pxPosition = pxSweepHit.position, pxNormal = pxSweepHit.normal;
|
|
@@ -1163,19 +1174,18 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
1163
1174
|
normal.set(pxNormal.x, pxNormal.y, pxNormal.z);
|
|
1164
1175
|
outHitResult(pxSweepHit.getShape().getUUID(), pxSweepHit.distance, position, normal);
|
|
1165
1176
|
}
|
|
1166
|
-
pxSweepCallback.delete();
|
|
1167
|
-
pxSweepHit.delete();
|
|
1168
1177
|
return result;
|
|
1169
1178
|
};
|
|
1170
1179
|
_proto._overlapMultiple = function _overlapMultiple(geometry, pose, onOverlap) {
|
|
1171
|
-
var
|
|
1172
|
-
|
|
1173
|
-
return onOverlap(index) ? 2 : 0;
|
|
1174
|
-
}
|
|
1175
|
-
};
|
|
1176
|
-
var pxOverlapCallback = this._physXPhysics._physX.PxQueryFilterCallback.implement(overlapCallback);
|
|
1180
|
+
var prevOnQuery = this._currentOnQuery;
|
|
1181
|
+
this._currentOnQuery = onOverlap;
|
|
1177
1182
|
var maxHits = 256;
|
|
1178
|
-
var hits
|
|
1183
|
+
var hits;
|
|
1184
|
+
try {
|
|
1185
|
+
hits = this._pxScene.overlapMultiple(geometry, pose, maxHits, this._pxFilterData, this._pxQueryCallback);
|
|
1186
|
+
} finally{
|
|
1187
|
+
this._currentOnQuery = prevOnQuery;
|
|
1188
|
+
}
|
|
1179
1189
|
var result = PhysXPhysicsScene._tempShapeIDs;
|
|
1180
1190
|
result.length = 0;
|
|
1181
1191
|
if (hits) {
|
|
@@ -1184,7 +1194,6 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
1184
1194
|
result.push(hits.get(i).getShape().getUUID());
|
|
1185
1195
|
}
|
|
1186
1196
|
}
|
|
1187
|
-
pxOverlapCallback.delete();
|
|
1188
1197
|
hits == null ? void 0 : hits.delete();
|
|
1189
1198
|
return result;
|
|
1190
1199
|
};
|
|
@@ -1765,9 +1774,9 @@ PhysXMeshColliderShape._tightBoundsFlag = 1 // eTIGHT_BOUNDS = 1 (1<<0)
|
|
|
1765
1774
|
this._initializeState = 0;
|
|
1766
1775
|
this._runTimeMode = runtimeMode;
|
|
1767
1776
|
var _runtimeUrls_wasmSIMDModeUrl;
|
|
1768
|
-
this._wasmSIMDModeUrl = (_runtimeUrls_wasmSIMDModeUrl = runtimeUrls == null ? void 0 : runtimeUrls.wasmSIMDModeUrl) != null ? _runtimeUrls_wasmSIMDModeUrl : "https://mdn.alipayobjects.com/rms/afts/file/A*
|
|
1777
|
+
this._wasmSIMDModeUrl = (_runtimeUrls_wasmSIMDModeUrl = runtimeUrls == null ? void 0 : runtimeUrls.wasmSIMDModeUrl) != null ? _runtimeUrls_wasmSIMDModeUrl : "https://mdn.alipayobjects.com/rms/afts/file/A*iHrYQKBrgTAAAAAAQ4AAAAgAehQnAQ/physx.release.simd.js";
|
|
1769
1778
|
var _runtimeUrls_wasmModeUrl;
|
|
1770
|
-
this._wasmModeUrl = (_runtimeUrls_wasmModeUrl = runtimeUrls == null ? void 0 : runtimeUrls.wasmModeUrl) != null ? _runtimeUrls_wasmModeUrl : "https://mdn.alipayobjects.com/rms/afts/file/A*
|
|
1779
|
+
this._wasmModeUrl = (_runtimeUrls_wasmModeUrl = runtimeUrls == null ? void 0 : runtimeUrls.wasmModeUrl) != null ? _runtimeUrls_wasmModeUrl : "https://mdn.alipayobjects.com/rms/afts/file/A*DFuvR6Mv5C0AAAAAQ4AAAAgAehQnAQ/physx.release.js";
|
|
1771
1780
|
}
|
|
1772
1781
|
var _proto = PhysXPhysics.prototype;
|
|
1773
1782
|
/**
|
|
@@ -1937,7 +1946,7 @@ PhysXMeshColliderShape._tightBoundsFlag = 1 // eTIGHT_BOUNDS = 1 (1<<0)
|
|
|
1937
1946
|
}();
|
|
1938
1947
|
|
|
1939
1948
|
//@ts-ignore
|
|
1940
|
-
var version = "2.0.0-alpha.
|
|
1949
|
+
var version = "2.0.0-alpha.33";
|
|
1941
1950
|
console.log("Galacean Engine Physics PhysX Version: " + version);
|
|
1942
1951
|
|
|
1943
1952
|
export { PhysXPhysics, PhysXRuntimeMode, version };
|