@galacean/engine-physics-physx 0.0.0-experimental-2.0-migrate.5 → 0.0.0-experimental-2.0-skill.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +60 -191
- 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 +60 -191
- package/dist/main.js.map +1 -1
- package/dist/module.js +60 -191
- package/dist/module.js.map +1 -1
- package/package.json +6 -5
- package/types/PhysXDynamicCollider.d.ts +1 -38
- package/types/PhysXPhysics.d.ts +1 -28
- package/types/PhysXPhysicsScene.d.ts +0 -5
- package/types/index.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-physics-physx",
|
|
3
|
-
"version": "0.0.0-experimental-2.0-
|
|
3
|
+
"version": "0.0.0-experimental-2.0-skill.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"main": "dist/main.js",
|
|
13
13
|
"module": "dist/module.js",
|
|
14
|
+
"unpkg": "dist/browser.min.js",
|
|
15
|
+
"jsdelivr": "dist/browser.min.js",
|
|
14
16
|
"debug": "src/index.ts",
|
|
15
|
-
"browser": "dist/browser.js",
|
|
16
17
|
"types": "types/index.d.ts",
|
|
17
18
|
"umd": {
|
|
18
19
|
"name": "Galacean.PhysicsPhysX",
|
|
@@ -26,11 +27,11 @@
|
|
|
26
27
|
"types/**/*"
|
|
27
28
|
],
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@galacean/engine-design": "0.0.0-experimental-2.0-
|
|
30
|
-
"@galacean/engine": "0.0.0-experimental-2.0-
|
|
30
|
+
"@galacean/engine-design": "0.0.0-experimental-2.0-skill.0",
|
|
31
|
+
"@galacean/engine": "0.0.0-experimental-2.0-skill.0"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
33
|
-
"@galacean/engine": "0.0.0-experimental-2.0-
|
|
34
|
+
"@galacean/engine": "0.0.0-experimental-2.0-skill.0"
|
|
34
35
|
},
|
|
35
36
|
"scripts": {
|
|
36
37
|
"b:types": "tsc"
|
|
@@ -21,18 +21,6 @@ export declare enum CollisionDetectionMode {
|
|
|
21
21
|
export declare class PhysXDynamicCollider extends PhysXCollider implements IDynamicCollider {
|
|
22
22
|
private static _tempTranslation;
|
|
23
23
|
private static _tempRotation;
|
|
24
|
-
/**
|
|
25
|
-
* Whether actor is currently kinematic.
|
|
26
|
-
* PhysX 拒绝在 kinematic actor 上启用 CCD(会打印警告并忽略),
|
|
27
|
-
* 所以 setCollisionDetectionMode 在 kinematic 状态下只缓存目标值,
|
|
28
|
-
* 等切回 dynamic 时再真正写到 PhysX。
|
|
29
|
-
*/
|
|
30
|
-
private _isKinematic;
|
|
31
|
-
/**
|
|
32
|
-
* Cached collision detection mode. Always reflects user's intent.
|
|
33
|
-
* 实际 PhysX CCD flag 可能跟这个不一致(kinematic 时强制 Discrete)。
|
|
34
|
-
*/
|
|
35
|
-
private _collisionDetectionMode;
|
|
36
24
|
constructor(physXPhysics: PhysXPhysics, position: Vector3, rotation: Quaternion);
|
|
37
25
|
/**
|
|
38
26
|
* {@inheritDoc IDynamicCollider.setLinearDamping }
|
|
@@ -92,7 +80,7 @@ export declare class PhysXDynamicCollider extends PhysXCollider implements IDyna
|
|
|
92
80
|
setMaxDepenetrationVelocity(value: number): void;
|
|
93
81
|
/**
|
|
94
82
|
* {@inheritDoc IDynamicCollider.setSleepThreshold }
|
|
95
|
-
* @default
|
|
83
|
+
* @default 1e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed
|
|
96
84
|
*/
|
|
97
85
|
setSleepThreshold(value: number): void;
|
|
98
86
|
/**
|
|
@@ -101,15 +89,6 @@ export declare class PhysXDynamicCollider extends PhysXCollider implements IDyna
|
|
|
101
89
|
setSolverIterations(value: number): void;
|
|
102
90
|
/**
|
|
103
91
|
* {@inheritDoc IDynamicCollider.setCollisionDetectionMode }
|
|
104
|
-
*
|
|
105
|
-
* PhysX 在 kinematic actor 上调用 setRigidBodyFlag(eENABLE_CCD, true) 会触发警告:
|
|
106
|
-
* "kinematic bodies with CCD enabled are not supported! CCD will be ignored"
|
|
107
|
-
* 虽然 PhysX 会忽略这次调用而非真的拒绝(切回 dynamic 时 flag 不会自动恢复),
|
|
108
|
-
* 但每次 setIsKinematic 切换都会让这个 warning 重复打印,污染日志,
|
|
109
|
-
* 同时让 actor 在 dynamic 状态下 CCD flag 状态不确定。
|
|
110
|
-
*
|
|
111
|
-
* 解决: 只在 dynamic 状态时立即 apply CCD flags。kinematic 时仅缓存到
|
|
112
|
-
* `_collisionDetectionMode`,等切回 dynamic 时由 setIsKinematic 重新 apply。
|
|
113
92
|
*/
|
|
114
93
|
setCollisionDetectionMode(value: number): void;
|
|
115
94
|
/**
|
|
@@ -118,25 +97,14 @@ export declare class PhysXDynamicCollider extends PhysXCollider implements IDyna
|
|
|
118
97
|
setUseGravity(value: boolean): void;
|
|
119
98
|
/**
|
|
120
99
|
* {@inheritDoc IDynamicCollider.setIsKinematic }
|
|
121
|
-
*
|
|
122
|
-
* 切换 kinematic 状态时同步处理 CCD flag:
|
|
123
|
-
* - 切到 kinematic 前先关 CCD(避免 PhysX 警告 + 让状态显式)
|
|
124
|
-
* - 切回 dynamic 后恢复用户期望的 CCD mode(来自 `_collisionDetectionMode` 缓存)
|
|
125
100
|
*/
|
|
126
101
|
setIsKinematic(value: boolean): void;
|
|
127
|
-
private _applyCollisionDetectionFlags;
|
|
128
102
|
/**
|
|
129
103
|
* {@inheritDoc IDynamicCollider.setConstraints }
|
|
130
104
|
*/
|
|
131
105
|
setConstraints(flags: number): void;
|
|
132
106
|
/**
|
|
133
107
|
* {@inheritDoc IDynamicCollider.addForce }
|
|
134
|
-
*
|
|
135
|
-
* PhysX 在 kinematic actor 上调 addForce 是 no-op(doc: "kinematic bodies don't
|
|
136
|
-
* respond to forces")。提前 return 避免无意义的 wasm boundary cross。
|
|
137
|
-
*
|
|
138
|
-
* Sleeping actor 不需要显式 wakeUp — wasm binding 调用 `addForce(force, eFORCE,
|
|
139
|
-
* autowake=true)`,PhysX 自动唤醒(已通过 `applyForce on sleeping actor` 测试验证)。
|
|
140
108
|
*/
|
|
141
109
|
addForce(force: Vector3): void;
|
|
142
110
|
/**
|
|
@@ -145,15 +113,10 @@ export declare class PhysXDynamicCollider extends PhysXCollider implements IDyna
|
|
|
145
113
|
addForceAtPosition(force: Vector3, position: Vector3): void;
|
|
146
114
|
/**
|
|
147
115
|
* {@inheritDoc IDynamicCollider.addTorque }
|
|
148
|
-
*
|
|
149
|
-
* 同 addForce — kinematic 提前 return,sleeping 由 PhysX autowake 自动处理。
|
|
150
116
|
*/
|
|
151
117
|
addTorque(torque: Vector3): void;
|
|
152
118
|
/**
|
|
153
119
|
* {@inheritDoc IDynamicCollider.move }
|
|
154
|
-
*
|
|
155
|
-
* PhysX 要求 setKinematicTarget 的 rotation 是 normalized quaternion,否则会触发
|
|
156
|
-
* 内部 assertion / 警告,并把 actor 转到错误的姿态。所以在写入 wasm 边界前统一 normalize。
|
|
157
120
|
*/
|
|
158
121
|
move(positionOrRotation: Vector3 | Quaternion, rotation?: Quaternion): void;
|
|
159
122
|
/**
|
package/types/PhysXPhysics.d.ts
CHANGED
|
@@ -16,17 +16,12 @@ export declare class PhysXPhysics implements IPhysics {
|
|
|
16
16
|
private _tolerancesScale;
|
|
17
17
|
private _wasmSIMDModeUrl;
|
|
18
18
|
private _wasmModeUrl;
|
|
19
|
-
private _tolerancesScaleOptions;
|
|
20
|
-
private _defaultContactOffset;
|
|
21
|
-
private _defaultSleepThreshold;
|
|
22
19
|
/**
|
|
23
20
|
* Create a PhysXPhysics instance.
|
|
24
21
|
* @param runtimeMode - Runtime mode, `Auto` prefers WebAssembly SIMD if supported @see {@link PhysXRuntimeMode}
|
|
25
22
|
* @param runtimeUrls - Manually specify the runtime URLs
|
|
26
|
-
* @param options - PhysX options.
|
|
27
23
|
*/
|
|
28
|
-
constructor(runtimeMode?: PhysXRuntimeMode, runtimeUrls?: PhysXRuntimeUrls
|
|
29
|
-
constructor(options?: PhysXPhysicsOptions);
|
|
24
|
+
constructor(runtimeMode?: PhysXRuntimeMode, runtimeUrls?: PhysXRuntimeUrls);
|
|
30
25
|
/**
|
|
31
26
|
* Initialize PhysXPhysics.
|
|
32
27
|
* @param runtimeMode - Runtime mode
|
|
@@ -45,14 +40,6 @@ export declare class PhysXPhysics implements IPhysics {
|
|
|
45
40
|
* {@inheritDoc IPhysics.createPhysicsScene }
|
|
46
41
|
*/
|
|
47
42
|
createPhysicsScene(physicsManager: PhysXPhysicsManager): IPhysicsScene;
|
|
48
|
-
/**
|
|
49
|
-
* {@inheritDoc IPhysics.getDefaultContactOffset }
|
|
50
|
-
*/
|
|
51
|
-
getDefaultContactOffset(): number;
|
|
52
|
-
/**
|
|
53
|
-
* {@inheritDoc IPhysics.getDefaultSleepThreshold }
|
|
54
|
-
*/
|
|
55
|
-
getDefaultSleepThreshold(): number;
|
|
56
43
|
/**
|
|
57
44
|
* {@inheritDoc IPhysics.createStaticCollider }
|
|
58
45
|
*/
|
|
@@ -110,10 +97,6 @@ export declare class PhysXPhysics implements IPhysics {
|
|
|
110
97
|
*/
|
|
111
98
|
setColliderLayerCollision(layer1: number, layer2: number, isCollide: boolean): void;
|
|
112
99
|
private _init;
|
|
113
|
-
private _applyTolerancesScale;
|
|
114
|
-
private _assertPositiveFinite;
|
|
115
|
-
private _validateTolerancesScale;
|
|
116
|
-
private _updateScaledDefaults;
|
|
117
100
|
}
|
|
118
101
|
interface PhysXRuntimeUrls {
|
|
119
102
|
/*** The URL of `PhysXRuntimeMode.WebAssembly` mode. */
|
|
@@ -121,14 +104,4 @@ interface PhysXRuntimeUrls {
|
|
|
121
104
|
/*** The URL of `PhysXRuntimeMode.WebAssemblySIMD` mode. */
|
|
122
105
|
wasmSIMDModeUrl?: string;
|
|
123
106
|
}
|
|
124
|
-
export interface PhysXTolerancesScale {
|
|
125
|
-
/** Approximate object length in the simulation unit. PhysX default is 1. */
|
|
126
|
-
length?: number;
|
|
127
|
-
/** Typical object speed in the simulation unit. PhysX default is 10. */
|
|
128
|
-
speed?: number;
|
|
129
|
-
}
|
|
130
|
-
export interface PhysXPhysicsOptions {
|
|
131
|
-
/** PhysX world unit scale used before PxPhysics, PxSceneDesc and PxCookingParams are created. */
|
|
132
|
-
tolerancesScale?: PhysXTolerancesScale;
|
|
133
|
-
}
|
|
134
107
|
export {};
|
|
@@ -29,7 +29,6 @@ export declare class PhysXPhysicsScene implements IPhysicsScene {
|
|
|
29
29
|
private _activeTriggers;
|
|
30
30
|
private _contactEvents;
|
|
31
31
|
private _contactEventCount;
|
|
32
|
-
private _contactEventEnabled;
|
|
33
32
|
private _triggerEvents;
|
|
34
33
|
private _physicsEvents;
|
|
35
34
|
private _triggerEventPool;
|
|
@@ -58,10 +57,6 @@ export declare class PhysXPhysicsScene implements IPhysicsScene {
|
|
|
58
57
|
* {@inheritDoc IPhysicsScene.update }
|
|
59
58
|
*/
|
|
60
59
|
update(elapsedTime: number): void;
|
|
61
|
-
/**
|
|
62
|
-
* {@inheritDoc IPhysicsScene.setContactEventEnabled }
|
|
63
|
-
*/
|
|
64
|
-
setContactEventEnabled(enabled: boolean): void;
|
|
65
60
|
/**
|
|
66
61
|
* {@inheritDoc IPhysicsScene.updateEvents }
|
|
67
62
|
*/
|
package/types/index.d.ts
CHANGED