@woosh/meep-engine 2.143.0 → 2.145.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/package.json +1 -1
- package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/BVH.js +158 -4
- package/src/core/geom/3d/shape/CylinderShape3D.d.ts +56 -0
- package/src/core/geom/3d/shape/CylinderShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/CylinderShape3D.js +223 -0
- package/src/core/geom/3d/shape/PointShape3D.d.ts +1 -0
- package/src/core/geom/3d/shape/PointShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/PointShape3D.js +11 -0
- package/src/core/geom/3d/shape/SphereShape3D.d.ts +1 -0
- package/src/core/geom/3d/shape/SphereShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/SphereShape3D.js +4 -0
- package/src/core/geom/3d/shape/json/shape_to_type.d.ts.map +1 -1
- package/src/core/geom/3d/shape/json/shape_to_type.js +3 -0
- package/src/core/geom/3d/shape/json/type_adapters.d.ts +15 -0
- package/src/core/geom/3d/shape/json/type_adapters.d.ts.map +1 -1
- package/src/core/geom/3d/shape/json/type_adapters.js +16 -0
- package/src/engine/control/first-person/DESIGN_COLLISION.md +314 -217
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +104 -58
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +1828 -1789
- package/src/engine/control/first-person/TODO.md +17 -32
- package/src/engine/control/first-person/abilities/WallRun.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/WallRun.js +18 -35
- package/src/engine/control/first-person/collision/KinematicMover.d.ts +206 -0
- package/src/engine/control/first-person/collision/KinematicMover.d.ts.map +1 -0
- package/src/engine/control/first-person/collision/KinematicMover.js +592 -0
- package/src/engine/control/first-person/prototype_first_person_controller.js +65 -0
- package/src/engine/graphics/render/buffer/simple-fx/ao/SAOShader.js +18 -9
- package/src/engine/physics/PLAN.md +145 -41
- package/src/engine/physics/contact/ManifoldStore.d.ts +28 -2
- package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
- package/src/engine/physics/contact/ManifoldStore.js +37 -3
- package/src/engine/physics/contact/combine_material.d.ts +30 -0
- package/src/engine/physics/contact/combine_material.d.ts.map +1 -0
- package/src/engine/physics/contact/combine_material.js +35 -0
- package/src/engine/physics/ecs/Collider.d.ts +15 -0
- package/src/engine/physics/ecs/Collider.d.ts.map +1 -1
- package/src/engine/physics/ecs/Collider.js +34 -0
- package/src/engine/physics/ecs/Joint.d.ts +18 -0
- package/src/engine/physics/ecs/Joint.d.ts.map +1 -1
- package/src/engine/physics/ecs/Joint.js +70 -0
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +9 -4
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +9 -4
- package/src/engine/physics/ecs/RigidBody.d.ts +15 -0
- package/src/engine/physics/ecs/RigidBody.d.ts.map +1 -1
- package/src/engine/physics/ecs/RigidBody.js +46 -0
- package/src/engine/physics/narrowphase/compute_penetration.d.ts +41 -41
- package/src/engine/physics/narrowphase/compute_penetration.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/compute_penetration.js +96 -169
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts +52 -0
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +130 -3
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -1
- package/src/engine/physics/solver/solve_contacts.js +10 -21
|
@@ -56,14 +56,30 @@ export class FirstPersonPlayerControllerSystem extends System<any, any, any, any
|
|
|
56
56
|
*/
|
|
57
57
|
groundResolver: (x: number, y: number, z: number) => number | null;
|
|
58
58
|
/**
|
|
59
|
-
* PhysicsSystem reference
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* physics.
|
|
59
|
+
* PhysicsSystem reference. Auto-acquired at startup; can be
|
|
60
|
+
* overridden by the caller. When present, collision is resolved
|
|
61
|
+
* by the {@link KinematicMover}; when null, the controller uses
|
|
62
|
+
* the flat-ground integrator ({@link _moveFlatGround}) — useful
|
|
63
|
+
* for spec setups that don't wire physics.
|
|
64
64
|
* @type {PhysicsSystem|null}
|
|
65
65
|
*/
|
|
66
66
|
physicsSystem: PhysicsSystem | null;
|
|
67
|
+
/**
|
|
68
|
+
* The collision solver — the authoritative move resolver whenever
|
|
69
|
+
* a {@link PhysicsSystem} is present (recover + unified
|
|
70
|
+
* sweep-and-slide + ground-categorize; see DESIGN_COLLISION.md).
|
|
71
|
+
* Lazily built on first use. With no physics the controller falls
|
|
72
|
+
* back to a flat-ground integrator ({@link _moveFlatGround}).
|
|
73
|
+
* @private
|
|
74
|
+
* @type {KinematicMover|null}
|
|
75
|
+
*/
|
|
76
|
+
private _mover;
|
|
77
|
+
/** @private Scratch velocity handed to the mover each tick. */
|
|
78
|
+
private _moverVelocity;
|
|
79
|
+
/** @private Scratch for the posture-headroom up-cast. */
|
|
80
|
+
private _postureRay;
|
|
81
|
+
/** @private @type {PhysicsSurfacePoint} */
|
|
82
|
+
private _postureHit;
|
|
67
83
|
startup(entityManager: any): Promise<void>;
|
|
68
84
|
/**
|
|
69
85
|
* @param {FirstPersonPlayerController} controller
|
|
@@ -117,7 +133,27 @@ export class FirstPersonPlayerControllerSystem extends System<any, any, any, any
|
|
|
117
133
|
* @private
|
|
118
134
|
*/
|
|
119
135
|
private _syncColliderShape;
|
|
120
|
-
_resolveCrouchHeld(controller: any, runtime: any): any;
|
|
136
|
+
_resolveCrouchHeld(controller: any, runtime: any, bodyTransform: any): any;
|
|
137
|
+
/**
|
|
138
|
+
* Headroom probe for a posture change that GROWS the collider.
|
|
139
|
+
* Sweeps `fromShape` (the shorter posture's capsule) straight up by
|
|
140
|
+
* `growDelta` (the height the collider would gain). A hit means an
|
|
141
|
+
* overhang occupies the space the taller posture needs, so the grow
|
|
142
|
+
* is blocked. Returns true (clear) when no physics is wired or the
|
|
143
|
+
* grow is non-positive.
|
|
144
|
+
*
|
|
145
|
+
* Why an up-cast rather than an overlap-test of the taller shape:
|
|
146
|
+
* overlap would false-positive on a wall *beside* the player. The
|
|
147
|
+
* up-cast sweeps parallel to (and, per the mover's skin clearance,
|
|
148
|
+
* clear of) lateral walls so they aren't hit; the floor is below
|
|
149
|
+
* the rising probe; the player's own body is filtered out. Only
|
|
150
|
+
* genuine overhead geometry blocks the grow. Relies on the player
|
|
151
|
+
* resting at `floor+skin` (the mover's stick-to-ground), so the
|
|
152
|
+
* probe's bottom starts clear of the floor.
|
|
153
|
+
*
|
|
154
|
+
* @private
|
|
155
|
+
*/
|
|
156
|
+
private _hasHeadroomToGrow;
|
|
121
157
|
/**
|
|
122
158
|
* Jump finite-state-machine: button-edge detection, buffer + coyote
|
|
123
159
|
* grace, anticipation timer, impulse on completion. Variable-height
|
|
@@ -132,48 +168,12 @@ export class FirstPersonPlayerControllerSystem extends System<any, any, any, any
|
|
|
132
168
|
*/
|
|
133
169
|
private _advanceJumpFsm;
|
|
134
170
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* - The broadphase shape-cast returns the back-along-the-sweep
|
|
142
|
-
* normal (`−direction`), not the true surface normal. With
|
|
143
|
-
* that, the principled "slide along the surface" residual is
|
|
144
|
-
* `delta -= dot(delta, n)·n = 0` — i.e. the player stops at
|
|
145
|
-
* contact instead of sliding tangent to the wall. Once
|
|
146
|
-
* narrowphase refinement lands and `result.normal` becomes the
|
|
147
|
-
* true surface normal, the same residual computation will
|
|
148
|
-
* naturally produce sliding without an API change.
|
|
149
|
-
* - SKIN clearance (5 mm) keeps the player just shy of the wall
|
|
150
|
-
* so the next cast doesn't start with the capsule already in
|
|
151
|
-
* contact. Picking this too small risks GJK reporting `t = 0`
|
|
152
|
-
* and the player getting stuck; too large is visible as a gap.
|
|
153
|
-
*
|
|
154
|
-
* Falls through to a direct position add when the host hasn't
|
|
155
|
-
* wired a {@link PhysicsSystem} — useful for spec setups that
|
|
156
|
-
* don't bring physics up.
|
|
157
|
-
*
|
|
158
|
-
* @private
|
|
159
|
-
* @param {PerEntityRuntime} runtime
|
|
160
|
-
* @param {Transform} bodyTransform
|
|
161
|
-
* @param {number} deltaX
|
|
162
|
-
* @param {number} deltaY
|
|
163
|
-
* @param {number} deltaZ
|
|
164
|
-
* @returns {boolean} true if a contact occurred (and the sweep was
|
|
165
|
-
* truncated); false on a clean full advance.
|
|
166
|
-
*/
|
|
167
|
-
private _moveAndSlide;
|
|
168
|
-
/**
|
|
169
|
-
* Gravity (with fall and cut multipliers), vertical integration,
|
|
170
|
-
* built-in flat-floor resolution (land event + impulse), and jump-apex
|
|
171
|
-
* detection. The full vertical phase of one fixed step.
|
|
172
|
-
*
|
|
173
|
-
* The built-in flat-floor branch only runs when `useBuiltInFlatGround`
|
|
174
|
-
* is true (the prototype's standalone mode); with an external physics
|
|
175
|
-
* layer attached the system relies on the layer to set `state.grounded`
|
|
176
|
-
* and only maintains airborne/grounded timers here.
|
|
171
|
+
* The vertical + collision phase of one fixed step: apply gravity
|
|
172
|
+
* (the motor), resolve the move against the world, then detect the
|
|
173
|
+
* jump apex. Collision resolution is the {@link KinematicMover} when
|
|
174
|
+
* a physics layer is present; otherwise a lightweight flat-ground
|
|
175
|
+
* integrator for headless / unit-test scenes with no collidable
|
|
176
|
+
* geometry. Land / leave-ground events flow identically from either.
|
|
177
177
|
*
|
|
178
178
|
* @private
|
|
179
179
|
* @param {FirstPersonPlayerController} controller
|
|
@@ -182,6 +182,62 @@ export class FirstPersonPlayerControllerSystem extends System<any, any, any, any
|
|
|
182
182
|
* @param {number} dt
|
|
183
183
|
*/
|
|
184
184
|
private _integrateVerticalAndResolveGround;
|
|
185
|
+
/**
|
|
186
|
+
* Resolve the current `runtime.velocity*` against the world — the
|
|
187
|
+
* physics-backed {@link KinematicMover} (recover + sweep-and-slide +
|
|
188
|
+
* ground-categorize) when a PhysicsSystem is present, else the no-physics
|
|
189
|
+
* flat-ground fallback. Gravity is NOT applied here: the standard path
|
|
190
|
+
* applies it in {@link _applyGravity} just before, and abilities with a
|
|
191
|
+
* non-standard vertical model (WallRun's reduced gravity) apply their own
|
|
192
|
+
* and then call this directly — so motion routes through one motor for
|
|
193
|
+
* everyone (sweep-and-slide, anti-tunnel, land/leave events) rather than
|
|
194
|
+
* a bespoke `position._add` + hand-rolled ground-catch.
|
|
195
|
+
* @private
|
|
196
|
+
*/
|
|
197
|
+
private _resolveMotion;
|
|
198
|
+
/**
|
|
199
|
+
* Motor: integrate gravity into `velocityY` with the fall / variable-
|
|
200
|
+
* cut multipliers. The mover never invents motion, so gravity lives
|
|
201
|
+
* here (callable by abilities that want standard gravity too).
|
|
202
|
+
* @private
|
|
203
|
+
*/
|
|
204
|
+
private _applyGravity;
|
|
205
|
+
/**
|
|
206
|
+
* Resolve the move against the world via {@link KinematicMover}
|
|
207
|
+
* (recover + unified sweep-and-slide + ground-categorize), then map
|
|
208
|
+
* the result back to controller state and land / leave events.
|
|
209
|
+
* @private
|
|
210
|
+
*/
|
|
211
|
+
private _moveViaMover;
|
|
212
|
+
/**
|
|
213
|
+
* No-physics fallback: integrate the velocity directly (there's no
|
|
214
|
+
* collidable geometry to sweep against) and resolve the floor from
|
|
215
|
+
* the built-in flat ground and/or the host `groundResolver`. For
|
|
216
|
+
* headless scenes and control-layer unit tests. With both ground
|
|
217
|
+
* sources off, an external physics layer is expected to own
|
|
218
|
+
* `state.grounded`; we only advance timers.
|
|
219
|
+
* @private
|
|
220
|
+
*/
|
|
221
|
+
private _moveFlatGround;
|
|
222
|
+
/**
|
|
223
|
+
* Landing transition: dip / impact springs, exertion impulse, flag
|
|
224
|
+
* resets, and the `onLand` signal (fired LAST so handlers see fully-
|
|
225
|
+
* reacted state). Shared by both move paths. `impactVy` is the
|
|
226
|
+
* downward speed at touchdown (positive).
|
|
227
|
+
* @private
|
|
228
|
+
*/
|
|
229
|
+
private _onLand;
|
|
230
|
+
/**
|
|
231
|
+
* Leave-ground transition: `onLeaveGround` signal + takeoff bookkeeping.
|
|
232
|
+
* Shared by both move paths.
|
|
233
|
+
* @private
|
|
234
|
+
*/
|
|
235
|
+
private _onLeaveGround;
|
|
236
|
+
/**
|
|
237
|
+
* Fire `onJumpApex` once, when an in-progress jump stops rising.
|
|
238
|
+
* @private
|
|
239
|
+
*/
|
|
240
|
+
private _detectJumpApex;
|
|
185
241
|
/**
|
|
186
242
|
* Run the base (no-ability) L1 locomotion phases: speed selection,
|
|
187
243
|
* desired-velocity computation, accel/decel, jump FSM, gravity, body
|
|
@@ -264,16 +320,6 @@ declare class PerEntityRuntime {
|
|
|
264
320
|
* @type {Collider|null}
|
|
265
321
|
*/
|
|
266
322
|
collider: Collider | null;
|
|
267
|
-
/**
|
|
268
|
-
* Pre-allocated move-and-slide scratch — Ray3 and PhysicsSurfacePoint
|
|
269
|
-
* reused per cast so the controller doesn't churn the allocator
|
|
270
|
-
* each fixed step. Lazily filled by {@link _moveAndSlide}.
|
|
271
|
-
* @private
|
|
272
|
-
* @type {Ray3|null}
|
|
273
|
-
*/
|
|
274
|
-
private slideRay;
|
|
275
|
-
/** @private @type {PhysicsSurfacePoint|null} */
|
|
276
|
-
private slideHit;
|
|
277
323
|
/**
|
|
278
324
|
* Pre-built capsule colliders, one per posture. Cached at link
|
|
279
325
|
* from `config.body.{height, crouchHeight, proneHeight, radius}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirstPersonPlayerControllerSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/control/first-person/FirstPersonPlayerControllerSystem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FirstPersonPlayerControllerSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/control/first-person/FirstPers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