@aura3d/physics 2.0.0 → 2.0.2

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.
Files changed (73) hide show
  1. package/package.json +2 -2
  2. package/dist/CharacterController.d.ts +0 -135
  3. package/dist/CharacterController.d.ts.map +0 -1
  4. package/dist/CharacterController.js +0 -609
  5. package/dist/CharacterController.js.map +0 -1
  6. package/dist/ClothFixtures.d.ts +0 -87
  7. package/dist/ClothFixtures.d.ts.map +0 -1
  8. package/dist/ClothFixtures.js +0 -264
  9. package/dist/ClothFixtures.js.map +0 -1
  10. package/dist/Crowd.d.ts +0 -64
  11. package/dist/Crowd.d.ts.map +0 -1
  12. package/dist/Crowd.js +0 -209
  13. package/dist/Crowd.js.map +0 -1
  14. package/dist/FireSmokeFixtures.d.ts +0 -103
  15. package/dist/FireSmokeFixtures.d.ts.map +0 -1
  16. package/dist/FireSmokeFixtures.js +0 -271
  17. package/dist/FireSmokeFixtures.js.map +0 -1
  18. package/dist/FluidFixtures.d.ts +0 -75
  19. package/dist/FluidFixtures.d.ts.map +0 -1
  20. package/dist/FluidFixtures.js +0 -219
  21. package/dist/FluidFixtures.js.map +0 -1
  22. package/dist/FractureFixtures.d.ts +0 -68
  23. package/dist/FractureFixtures.d.ts.map +0 -1
  24. package/dist/FractureFixtures.js +0 -199
  25. package/dist/FractureFixtures.js.map +0 -1
  26. package/dist/NarrowPhase.d.ts +0 -11
  27. package/dist/NarrowPhase.d.ts.map +0 -1
  28. package/dist/NarrowPhase.js +0 -565
  29. package/dist/NarrowPhase.js.map +0 -1
  30. package/dist/Navigation.d.ts +0 -67
  31. package/dist/Navigation.d.ts.map +0 -1
  32. package/dist/Navigation.js +0 -261
  33. package/dist/Navigation.js.map +0 -1
  34. package/dist/PathFollowDriver.d.ts +0 -162
  35. package/dist/PathFollowDriver.d.ts.map +0 -1
  36. package/dist/PathFollowDriver.js +0 -163
  37. package/dist/PathFollowDriver.js.map +0 -1
  38. package/dist/PhysicsSandboxFixtures.d.ts +0 -53
  39. package/dist/PhysicsSandboxFixtures.d.ts.map +0 -1
  40. package/dist/PhysicsSandboxFixtures.js +0 -280
  41. package/dist/PhysicsSandboxFixtures.js.map +0 -1
  42. package/dist/PlatformerFixtures.d.ts +0 -70
  43. package/dist/PlatformerFixtures.d.ts.map +0 -1
  44. package/dist/PlatformerFixtures.js +0 -120
  45. package/dist/PlatformerFixtures.js.map +0 -1
  46. package/dist/RacingLineProfile.d.ts +0 -116
  47. package/dist/RacingLineProfile.d.ts.map +0 -1
  48. package/dist/RacingLineProfile.js +0 -181
  49. package/dist/RacingLineProfile.js.map +0 -1
  50. package/dist/SoftBodyFixtures.d.ts +0 -70
  51. package/dist/SoftBodyFixtures.d.ts.map +0 -1
  52. package/dist/SoftBodyFixtures.js +0 -272
  53. package/dist/SoftBodyFixtures.js.map +0 -1
  54. package/dist/Steering.d.ts +0 -161
  55. package/dist/Steering.d.ts.map +0 -1
  56. package/dist/Steering.js +0 -347
  57. package/dist/Steering.js.map +0 -1
  58. package/dist/VehicleDynamics.d.ts +0 -162
  59. package/dist/VehicleDynamics.d.ts.map +0 -1
  60. package/dist/VehicleDynamics.js +0 -363
  61. package/dist/VehicleDynamics.js.map +0 -1
  62. package/dist/VehicleMotion.d.ts +0 -125
  63. package/dist/VehicleMotion.d.ts.map +0 -1
  64. package/dist/VehicleMotion.js +0 -373
  65. package/dist/VehicleMotion.js.map +0 -1
  66. package/dist/solverless-entry.d.ts +0 -41
  67. package/dist/solverless-entry.d.ts.map +0 -1
  68. package/dist/solverless-entry.js +0 -40
  69. package/dist/solverless-entry.js.map +0 -1
  70. package/dist/world-entry.d.ts +0 -31
  71. package/dist/world-entry.d.ts.map +0 -1
  72. package/dist/world-entry.js +0 -30
  73. package/dist/world-entry.js.map +0 -1
@@ -1,609 +0,0 @@
1
- import { KinematicBody } from "./KinematicBody.js";
2
- import { Shape, normalizeVec3 } from "./Shape.js";
3
- export class FightingCharacterController {
4
- body;
5
- walkSpeed;
6
- crouchSpeed;
7
- fastFallSpeed;
8
- state = "idle";
9
- constructor(descriptor = {}) {
10
- this.walkSpeed = positiveFinite(descriptor.walkSpeed ?? descriptor.maxSpeed ?? 4.5, "fighting controller walkSpeed");
11
- this.crouchSpeed = positiveFinite(descriptor.crouchSpeed ?? this.walkSpeed * 0.45, "fighting controller crouchSpeed");
12
- this.fastFallSpeed = positiveFinite(descriptor.fastFallSpeed ?? descriptor.maxFallSpeed ?? 20, "fighting controller fastFallSpeed");
13
- this.body = new KinematicBody({
14
- ...descriptor,
15
- id: descriptor.id ?? "fighter",
16
- halfExtents: descriptor.halfExtents ?? [0.32, 0.9, 0.25],
17
- maxSpeed: descriptor.maxSpeed ?? this.walkSpeed,
18
- acceleration: descriptor.acceleration ?? 54,
19
- airAcceleration: descriptor.airAcceleration ?? 24,
20
- groundFriction: descriptor.groundFriction ?? 56,
21
- airFriction: descriptor.airFriction ?? 4,
22
- gravity: descriptor.gravity ?? 26,
23
- jumpSpeed: descriptor.jumpSpeed ?? 9.4,
24
- maxFallSpeed: descriptor.maxFallSpeed ?? Math.max(this.fastFallSpeed, 20),
25
- dashSpeed: descriptor.dashSpeed ?? 8.6,
26
- dashDuration: descriptor.dashDuration ?? 0.12,
27
- dashCooldown: descriptor.dashCooldown ?? 0.18,
28
- groundSnapDistance: descriptor.groundSnapDistance ?? 0.06,
29
- lockDepth: descriptor.lockDepth ?? true
30
- });
31
- }
32
- walk(direction, speed) {
33
- const magnitude = Math.min(1, Math.abs(finiteOrZero(direction)));
34
- const facing = direction < 0 ? -1 : 1;
35
- const targetSpeed = speed ?? (this.body.snapshot().crouching ? this.crouchSpeed : this.walkSpeed);
36
- const normalizedSpeed = this.body.maxSpeed > 0 ? Math.min(1, positiveFinite(targetSpeed, "fighting controller walk speed") / this.body.maxSpeed) : 0;
37
- this.body.move(facing * magnitude * normalizedSpeed);
38
- this.state = magnitude > 0 ? "walk" : this.deriveState([]);
39
- }
40
- stop() {
41
- this.body.move(0);
42
- this.state = this.deriveState([]);
43
- }
44
- jump() {
45
- this.body.jump();
46
- this.state = "jump";
47
- }
48
- dash(direction) {
49
- this.body.dash(direction);
50
- this.state = "dash";
51
- }
52
- fastFall(speed = this.fastFallSpeed) {
53
- this.body.fastFall(speed);
54
- if (!this.body.grounded) {
55
- this.state = "fast-fall";
56
- }
57
- }
58
- crouch(active = true) {
59
- this.body.crouch(active);
60
- this.state = active ? "crouch" : this.deriveState([]);
61
- }
62
- step(dt, options = {}) {
63
- const events = this.body.step(dt, options);
64
- this.state = this.deriveState(events);
65
- return events;
66
- }
67
- snapshot() {
68
- return {
69
- ...this.body.snapshot(),
70
- state: this.state,
71
- walkSpeed: this.walkSpeed,
72
- crouchSpeed: this.crouchSpeed,
73
- fastFallSpeed: this.fastFallSpeed
74
- };
75
- }
76
- deriveState(events) {
77
- if (events.some((event) => event.type === "land"))
78
- return "landing";
79
- const snapshot = this.body.snapshot();
80
- if (snapshot.crouching)
81
- return "crouch";
82
- if (snapshot.dashFramesRemaining > 0)
83
- return "dash";
84
- if (!snapshot.grounded)
85
- return snapshot.velocity[1] < -this.fastFallSpeed * 0.5 ? "fast-fall" : "jump";
86
- return Math.abs(snapshot.velocity[0]) > 0.05 ? "walk" : "idle";
87
- }
88
- }
89
- export function createFightingCharacterController(descriptor = {}) {
90
- return new FightingCharacterController(descriptor);
91
- }
92
- export class CharacterController {
93
- world;
94
- body;
95
- collider;
96
- radius;
97
- halfHeight;
98
- maxSpeed;
99
- acceleration;
100
- jumpSpeed;
101
- groundProbeDistance;
102
- maxSlopeAngleRadians;
103
- maxStepHeight;
104
- stepDownDistance;
105
- wallSlide;
106
- collisionMask;
107
- moveInput = [0, 0];
108
- jumpQueued = false;
109
- state = {
110
- grounded: false,
111
- groundNormal: [0, 1, 0],
112
- groundColliderId: null,
113
- desiredVelocity: [0, 0, 0],
114
- velocity: [0, 0, 0],
115
- speed: 0,
116
- jumpedThisFrame: false,
117
- steppedUp: 0,
118
- steppedDown: 0,
119
- wallSliding: false,
120
- ceilingHit: false,
121
- slopeAngle: 0,
122
- onSteepSlope: false
123
- };
124
- constructor(world, descriptor = {}) {
125
- this.world = world;
126
- this.radius = positiveFinite(descriptor.radius ?? 0.24, "character radius");
127
- this.halfHeight = positiveFinite(descriptor.halfHeight ?? 0.38, "character halfHeight");
128
- this.maxSpeed = positiveFinite(descriptor.maxSpeed ?? 3.5, "character maxSpeed");
129
- this.acceleration = positiveFinite(descriptor.acceleration ?? 32, "character acceleration");
130
- this.jumpSpeed = positiveFinite(descriptor.jumpSpeed ?? 4.2, "character jumpSpeed");
131
- this.groundProbeDistance = positiveFinite(descriptor.groundProbeDistance ?? 0.12, "character groundProbeDistance");
132
- this.maxSlopeAngleRadians = positiveFinite(descriptor.maxSlopeAngleRadians ?? Math.PI / 3, "character maxSlopeAngleRadians");
133
- // Default step height is a third of the capsule's total height: tall enough for kerbs
134
- // and stair treads, short enough that a character cannot walk up a wall.
135
- this.maxStepHeight = Math.max(0, descriptor.maxStepHeight ?? (this.halfHeight + this.radius) * 0.34);
136
- this.stepDownDistance = Math.max(0, descriptor.stepDownDistance ?? this.maxStepHeight);
137
- this.wallSlide = descriptor.wallSlide ?? true;
138
- this.collisionMask = descriptor.collisionMask;
139
- this.body = world.createRigidBody({
140
- type: "dynamic",
141
- position: descriptor.position ?? [0, this.halfHeight + this.radius, 0],
142
- mass: 1,
143
- linearDamping: 0.02,
144
- angularDamping: 1
145
- });
146
- this.collider = world.createCollider(this.body, {
147
- shape: Shape.capsule(this.radius, this.halfHeight),
148
- material: { friction: 0.05, restitution: 0 }
149
- });
150
- }
151
- setMoveInput(input) {
152
- const x = finiteOrZero(input.x);
153
- const z = finiteOrZero(input.z ?? 0);
154
- const length = Math.hypot(x, z);
155
- this.moveInput = length > 1 ? [x / length, z / length] : [x, z];
156
- }
157
- jump() {
158
- this.jumpQueued = true;
159
- }
160
- teleport(position) {
161
- this.body.setPosition(position);
162
- this.body.setVelocity([0, 0, 0]);
163
- this.state = {
164
- ...this.state,
165
- grounded: false,
166
- groundColliderId: null,
167
- velocity: [0, 0, 0],
168
- speed: 0,
169
- jumpedThisFrame: false,
170
- steppedUp: 0,
171
- steppedDown: 0,
172
- wallSliding: false,
173
- ceilingHit: false,
174
- slopeAngle: 0,
175
- onSteepSlope: false
176
- };
177
- }
178
- step(dt) {
179
- if (!Number.isFinite(dt) || dt <= 0) {
180
- throw new Error("CharacterController.step dt must be finite and positive.");
181
- }
182
- const ground = this.probeGround();
183
- const desiredVelocity = [
184
- this.moveInput[0] * this.maxSpeed,
185
- this.body.velocity[1],
186
- this.moveInput[1] * this.maxSpeed
187
- ];
188
- const nextVelocity = [
189
- moveToward(this.body.velocity[0], desiredVelocity[0], this.acceleration * dt),
190
- this.body.velocity[1],
191
- moveToward(this.body.velocity[2], desiredVelocity[2], this.acceleration * dt)
192
- ];
193
- let jumpedThisFrame = false;
194
- if (ground.grounded && nextVelocity[1] < 0) {
195
- nextVelocity[1] = 0;
196
- }
197
- /*
198
- * Wall slide: redirect blocked motion along the surface instead of stopping.
199
- *
200
- * Without this a capsule pressed into a wall at an angle loses all its speed, because
201
- * the solver cancels the whole velocity rather than only the component into the wall.
202
- * The player feels it as sticking on geometry they are trying to run past. Removing
203
- * only the normal component is the standard fix and is what "slide" means.
204
- */
205
- let wallSliding = false;
206
- const horizontalSpeed = Math.hypot(nextVelocity[0], nextVelocity[2]);
207
- // Captured before wall slide mutates nextVelocity; step-up needs the original intent.
208
- const intendedDirection = horizontalSpeed > 1e-6
209
- ? [nextVelocity[0] / horizontalSpeed, 0, nextVelocity[2] / horizontalSpeed]
210
- : [0, 0, 0];
211
- if (horizontalSpeed > 1e-4) {
212
- const direction = [nextVelocity[0] / horizontalSpeed, 0, nextVelocity[2] / horizontalSpeed];
213
- const wall = this.castHorizontal(direction, this.radius * 0.6);
214
- if (wall && Math.abs(wall.normal[1]) < 0.5) {
215
- if (this.wallSlide) {
216
- const into = nextVelocity[0] * wall.normal[0] + nextVelocity[2] * wall.normal[2];
217
- if (into < 0) {
218
- nextVelocity[0] -= wall.normal[0] * into;
219
- nextVelocity[2] -= wall.normal[2] * into;
220
- wallSliding = true;
221
- }
222
- }
223
- else {
224
- nextVelocity[0] = 0;
225
- nextVelocity[2] = 0;
226
- }
227
- }
228
- }
229
- /*
230
- * Step up: lift over a ledge no taller than `maxStepHeight`.
231
- *
232
- * A capsule has no notion of a stair. Presented with a kerb it sees a vertical wall and
233
- * stops, so a character walks into level geometry a player expects to stride over. The
234
- * test is: is the obstacle ahead low enough, and is there room above it to stand?
235
- */
236
- let steppedUp = 0;
237
- if (ground.grounded && this.maxStepHeight > 0 && horizontalSpeed > 1e-4) {
238
- /*
239
- * Use the *intended* direction, captured before the wall slide ran.
240
- *
241
- * Wall slide removes the component into the surface. Walking straight at a kerb that
242
- * means the whole horizontal velocity is removed, so reading `nextVelocity` here
243
- * found ~0 and the length guard skipped step-up entirely — the character stood
244
- * against a climbable ledge forever. A character trying to walk into a step should
245
- * step up precisely *because* its motion was blocked.
246
- */
247
- const direction = [
248
- intendedDirection[0],
249
- 0,
250
- intendedDirection[2]
251
- ];
252
- {
253
- const blocked = this.castHorizontal(direction, this.radius * 0.6);
254
- /*
255
- * Only step once the capsule is actually *at* the ledge.
256
- *
257
- * `castHorizontal` reports how far its probe sphere travelled, and that sphere is
258
- * smaller than the capsule and starts at the capsule's centre — so `blocked.distance`
259
- * is not the gap to the obstacle at all. The real gap is
260
- * `probeRadius + distance - radius`, which `castHorizontal` now returns as `gap`.
261
- * Treating the raw travel as the surface gap
262
- * lifted the character while it was still ~0.5 units short of a 0.18-unit ledge, so
263
- * it rose over nothing, `probeGroundAt` found the low floor below, and step-down put
264
- * it straight back. Measured on a 0.18 ledge at x=3.0: step-up fired repeatedly from
265
- * x=2.46, each frame immediately undone by a 0.196 step-down, `grounded` flickering
266
- * true/false, and forward motion stalling for ~20 frames at a time before the
267
- * character crept past.
268
- *
269
- * That is precisely the oscillation step-down exists to prevent, caused by step-up.
270
- * The surface gap is the probe's travel less the capsule's own radius, and the
271
- * character may only be lifted when that gap is genuinely closing.
272
- */
273
- if (blocked && Math.abs(blocked.normal[1]) < 0.5) {
274
- const stepTarget = this.probeStepSurface(direction, blocked.distance);
275
- if (stepTarget !== undefined) {
276
- const rise = stepTarget - (this.body.position[1] - this.halfHeight - this.radius);
277
- if (rise > 1e-4 && rise <= this.maxStepHeight) {
278
- /*
279
- * Lift *and* carry the capsule over the edge, not lift alone.
280
- *
281
- * Lifting while the capsule is still short of the obstacle leaves it hanging
282
- * over the low floor it was already on. `probeGroundAt` then finds that floor
283
- * and step-down immediately undoes the lift — an up/down oscillation, one
284
- * cycle per frame, with `grounded` flickering and forward motion stalling.
285
- * Measured on a 0.18 ledge before this: step-up of 0.158 cancelled by a
286
- * step-down of 0.196, repeating for ~20 frames while x moved 0.004.
287
- *
288
- * That is the exact oscillation step-down exists to prevent, caused by
289
- * step-up.
290
- *
291
- * The fix has to be geometric, not a cooldown. A capsule lifted while its
292
- * centre is still short of the obstacle face has its *support point* over the
293
- * low floor, so the ground probe is right to find that floor and step-down is
294
- * right to act — suppressing step-down for a frame would only hide a character
295
- * standing on nothing. The capsule must clear the face: advance by the measured
296
- * surface gap (closing the remaining distance) plus its own radius (carrying
297
- * the support point past the edge), which is why a step-up is inherently a
298
- * small teleport rather than an impulse.
299
- */
300
- const carry = blocked.gap + this.radius * 1.05;
301
- this.body.setPosition([
302
- this.body.position[0] + direction[0] * carry,
303
- this.body.position[1] + rise,
304
- this.body.position[2] + direction[2] * carry
305
- ]);
306
- steppedUp = rise;
307
- // The obstacle is cleared, so the wall-slide redirect no longer applies.
308
- wallSliding = false;
309
- }
310
- }
311
- }
312
- }
313
- }
314
- /*
315
- * Step down: stay glued to a descending surface within `stepDownDistance`.
316
- *
317
- * Without this, walking down stairs launches the character off every edge: it leaves
318
- * the ground, falls, lands, and repeats. `grounded` flickers, which breaks coyote time,
319
- * footstep audio and any state machine keyed on standing on the floor.
320
- */
321
- let steppedDown = 0;
322
- if (!ground.grounded && !jumpedThisFrame && this.stepDownDistance > 0 && nextVelocity[1] <= 0 && this.state.grounded) {
323
- const below = this.probeGroundAt(this.stepDownDistance + this.radius);
324
- if (below.grounded && below.distance !== undefined && below.distance <= this.stepDownDistance) {
325
- this.body.setPosition([
326
- this.body.position[0],
327
- this.body.position[1] - below.distance,
328
- this.body.position[2]
329
- ]);
330
- steppedDown = below.distance;
331
- nextVelocity[1] = 0;
332
- }
333
- }
334
- if (this.jumpQueued && (ground.grounded || steppedDown > 0)) {
335
- nextVelocity[1] = this.jumpSpeed;
336
- jumpedThisFrame = true;
337
- }
338
- this.jumpQueued = false;
339
- /*
340
- * Ceiling: cancel upward velocity when the head is blocked.
341
- *
342
- * A jump into a low ceiling otherwise keeps its upward velocity and the character
343
- * hovers against the geometry for the rest of the rise, then drops — which reads as
344
- * sticking to the roof.
345
- */
346
- let ceilingHit = false;
347
- if (nextVelocity[1] > 0) {
348
- const headOrigin = [
349
- this.body.position[0],
350
- this.body.position[1] + this.halfHeight,
351
- this.body.position[2]
352
- ];
353
- const above = this.world.sphereCast(headOrigin, this.radius * 0.9, [0, 1, 0], {
354
- maxDistance: this.radius * 0.5,
355
- includeSensors: false,
356
- // Never detect our own capsule: a self-hit at distance 0 reads as a wall.
357
- ignoreBodies: [this.body.id],
358
- ...(this.collisionMask === undefined ? {} : { mask: this.collisionMask })
359
- });
360
- if (above && above.normal[1] < -0.3) {
361
- nextVelocity[1] = 0;
362
- ceilingHit = true;
363
- }
364
- }
365
- const grounded = (ground.grounded || steppedDown > 0) && !jumpedThisFrame;
366
- // Slope angle from the ground normal, so gameplay can react to a hill without
367
- // re-deriving it from a raycast the controller already did.
368
- const slopeAngle = grounded ? Math.acos(Math.min(1, Math.max(-1, ground.normal[1]))) : 0;
369
- this.body.setVelocity(nextVelocity);
370
- this.state = {
371
- grounded,
372
- groundNormal: ground.normal,
373
- groundColliderId: ground.colliderId,
374
- desiredVelocity,
375
- velocity: [...nextVelocity],
376
- speed: Math.hypot(nextVelocity[0], nextVelocity[2]),
377
- jumpedThisFrame,
378
- steppedUp,
379
- steppedDown,
380
- wallSliding,
381
- ceilingHit,
382
- slopeAngle,
383
- onSteepSlope: ground.steep === true
384
- };
385
- return this.state;
386
- }
387
- snapshot() {
388
- return {
389
- ...this.state,
390
- groundNormal: [...this.state.groundNormal],
391
- desiredVelocity: [...this.state.desiredVelocity],
392
- velocity: [...this.state.velocity]
393
- };
394
- }
395
- /**
396
- * Horizontal sweep ahead of the capsule's mid-section, for wall and ledge detection.
397
- *
398
- * Returns both the sweep's own travel (`distance`, which callers feed back into
399
- * `probeStepSurface` so the two probes stay consistent) and `gap`, the distance from the
400
- * **capsule's surface** to the obstacle. The two differ by the probe sphere's radius less
401
- * the capsule's, and conflating them is what made step-up fire early: see the comment at
402
- * the step-up call site.
403
- */
404
- castHorizontal(direction, distance) {
405
- /*
406
- * Probe just above the capsule's base, not above step height.
407
- *
408
- * An earlier version placed this at `base + maxStepHeight`, reasoning that a kerb
409
- * should not be mistaken for a wall. That put the probe *above* every obstacle it was
410
- * meant to find: with a 0.2 capsule and a 0.25 step height the probe sat at y=1.049
411
- * while the 0.18-unit ledge topped out at 0.68, so it reported no obstacle at all and
412
- * the character walked into the ledge and stopped without ever seeing it.
413
- *
414
- * The correct division of labour is: this probe finds *anything* ahead, and
415
- * `probeStepSurface` decides whether it is short enough to climb. Classifying the
416
- * obstacle is the step probe's job, not the wall probe's.
417
- */
418
- const probeRadius = this.radius * 0.7;
419
- /*
420
- * The sweep sphere must sit entirely above the floor the character stands on.
421
- *
422
- * At `base + 0.6r` with a `0.85r` sphere the sphere's underside reaches `base - 0.25r`
423
- * — below the floor — so the sweep detected the ground itself as a wall. The character
424
- * then believed it was permanently against an obstacle and never moved, at any
425
- * position, on flat ground.
426
- *
427
- * Offset by slightly more than the probe radius so the sphere clears the surface, and
428
- * keep the probe low enough to still see a kerb.
429
- */
430
- const origin = [
431
- this.body.position[0],
432
- this.body.position[1] - this.halfHeight - this.radius + probeRadius * 1.15,
433
- this.body.position[2]
434
- ];
435
- /*
436
- * Reach is expressed as a margin from the capsule's *surface*, not from its centre.
437
- *
438
- * Two corrections live here, in order.
439
- *
440
- * First: a sweep of radius 0.7r starting at the centre only extends 0.7r + travel, so
441
- * geometry the capsule is already touching — at exactly r — sat behind the reach and
442
- * reported no hit. The character walked into a ledge and stopped without ever seeing it.
443
- * Hence the `this.radius +` term.
444
- *
445
- * Second, and the reason this comment is longer than it was: that term double-counts.
446
- * The sweep sphere's leading point is already `probeRadius` ahead of its centre, so
447
- * `maxDistance = radius + distance` detects an obstacle `radius + distance + probeRadius`
448
- * from the centre — `distance + probeRadius` from the capsule's surface, not `distance`.
449
- * Measured with r=0.24: the intended 0.144 margin became 0.312, so the character halted
450
- * a third of its own radius short of every wall and ledge. Subtracting `probeRadius`
451
- * makes the requested margin mean what it says, which is what lets the step-up gate below
452
- * be stated in surface terms.
453
- */
454
- const hit = this.world.sphereCast(origin, probeRadius, direction, {
455
- maxDistance: Math.max(0, this.radius + distance - probeRadius),
456
- includeSensors: false,
457
- // Never detect our own capsule: a self-hit at distance 0 reads as a wall.
458
- ignoreBodies: [this.body.id],
459
- ...(this.collisionMask === undefined ? {} : { mask: this.collisionMask })
460
- });
461
- if (!hit)
462
- return undefined;
463
- /*
464
- * The probe sphere's leading point is `probeRadius` ahead of its centre, so the obstacle
465
- * sits `probeRadius + hit.distance` from the capsule's centre and `- this.radius` from the
466
- * capsule's surface. Clamped at zero: already-touching geometry reports a gap of 0, not a
467
- * negative one.
468
- */
469
- const gap = Math.max(0, probeRadius + hit.distance - this.radius);
470
- return { normal: orientAgainst(normalizeVec3(hit.normal), direction), distance: hit.distance, gap };
471
- }
472
- /**
473
- * Surface height just past an obstacle, or undefined when there is nothing to stand on.
474
- *
475
- * Probes downward from above the maximum step height at a point slightly ahead of the
476
- * capsule. If it finds a walkable surface, that height is the top of the step.
477
- */
478
- probeStepSurface(direction, obstacleDistance) {
479
- /*
480
- * Probe just past the obstacle the wall sweep actually found.
481
- *
482
- * A fixed `1.1 * radius` lookahead was wrong whenever the wall sweep triggered further
483
- * out than that: the character halted 0.246 units from a ledge while the step probe
484
- * sampled only 0.22 ahead, so it measured the *low* floor it was already standing on,
485
- * computed a rise of ~0, and never stepped. Deriving the lookahead from the measured
486
- * obstacle distance keeps the two probes consistent by construction.
487
- */
488
- const ahead = Math.max(this.radius * 1.1, obstacleDistance + this.radius * 0.85);
489
- const origin = [
490
- this.body.position[0] + direction[0] * ahead,
491
- this.body.position[1] - this.halfHeight - this.radius + this.maxStepHeight + this.radius,
492
- this.body.position[2] + direction[2] * ahead
493
- ];
494
- const hit = this.world.raycast(origin, [0, -1, 0], {
495
- maxDistance: this.maxStepHeight + this.radius * 2,
496
- includeSensors: false,
497
- // Never detect our own capsule: a self-hit at distance 0 reads as a wall.
498
- ignoreBodies: [this.body.id],
499
- ...(this.collisionMask === undefined ? {} : { mask: this.collisionMask })
500
- });
501
- if (!hit)
502
- return undefined;
503
- /*
504
- * Orient the normal against the ray before judging walkability.
505
- *
506
- * A raycast returns the face normal unoriented, so a downward ray landing on the top
507
- * face of a box can report [0,-1,0]. Testing that raw value against cos(maxSlope)
508
- * rejected every legitimate step: the top of a kerb looked like a ceiling.
509
- */
510
- const normal = orientAgainst(normalizeVec3(hit.normal), [0, -1, 0]);
511
- // A step is only a step if its top is walkable; a steep face is a wall.
512
- if (normal[1] < Math.cos(this.maxSlopeAngleRadians))
513
- return undefined;
514
- return hit.point[1];
515
- }
516
- /** Ground probe with a caller-supplied reach, used by step-down. */
517
- probeGroundAt(maxDistance) {
518
- const origin = [
519
- this.body.position[0],
520
- this.body.position[1] - this.halfHeight + this.groundProbeDistance,
521
- this.body.position[2]
522
- ];
523
- const hit = this.world.sphereCast(origin, this.radius * 0.92, [0, -1, 0], {
524
- maxDistance,
525
- includeSensors: false,
526
- // Never detect our own capsule: a self-hit at distance 0 reads as a wall.
527
- ignoreBodies: [this.body.id],
528
- ...(this.collisionMask === undefined ? {} : { mask: this.collisionMask })
529
- });
530
- const minGroundNormalY = Math.cos(this.maxSlopeAngleRadians);
531
- if (!hit)
532
- return { grounded: false, normal: [0, 1, 0], colliderId: null };
533
- /*
534
- * Orient before judging walkability, not after.
535
- *
536
- * A sweep against a box returns the face normal unoriented, so a downward probe onto a
537
- * flat floor reports [0,-1,0]. Comparing that raw value to cos(maxSlope) rejects the
538
- * floor: -1 < 0.5. The character stood on a solid surface and reported grounded:false
539
- * for every frame, which disabled jumping, step-up and step-down at once.
540
- */
541
- const normal = orientAgainst(normalizeVec3(hit.normal), [0, -1, 0]);
542
- if (normal[1] < minGroundNormalY) {
543
- return { grounded: false, normal, colliderId: hit.colliderId };
544
- }
545
- return {
546
- grounded: true,
547
- normal,
548
- colliderId: hit.colliderId,
549
- distance: Math.max(0, hit.distance - this.groundProbeDistance)
550
- };
551
- }
552
- probeGround() {
553
- const origin = [
554
- this.body.position[0],
555
- this.body.position[1] - this.halfHeight + this.groundProbeDistance,
556
- this.body.position[2]
557
- ];
558
- const hit = this.world.sphereCast(origin, this.radius * 0.92, [0, -1, 0], {
559
- maxDistance: this.groundProbeDistance + this.radius * 0.35,
560
- includeSensors: false,
561
- // Never detect our own capsule: a self-hit at distance 0 reads as a wall.
562
- ignoreBodies: [this.body.id],
563
- ...(this.collisionMask === undefined ? {} : { mask: this.collisionMask })
564
- });
565
- const minGroundNormalY = Math.cos(this.maxSlopeAngleRadians);
566
- if (!hit) {
567
- return { grounded: false, normal: [0, 1, 0], colliderId: null };
568
- }
569
- // Orient before the walkability test; see probeGroundAt for why this matters.
570
- const oriented = orientAgainst(normalizeVec3(hit.normal), [0, -1, 0]);
571
- if (oriented[1] < minGroundNormalY) {
572
- /*
573
- * Too steep to stand on, but still report the real normal.
574
- *
575
- * Returning world up here discarded the information a caller needs to slide down a
576
- * slope, and made a steep face indistinguishable from open air.
577
- */
578
- return { grounded: false, normal: oriented, colliderId: hit.colliderId, steep: true };
579
- }
580
- return { grounded: true, normal: oriented, colliderId: hit.colliderId };
581
- }
582
- }
583
- /**
584
- * Flip a normal so it faces back along the query direction.
585
- *
586
- * Raycasts and sweeps report a face's own normal, which may point either way depending on
587
- * winding. Callers almost always want the side they hit from.
588
- */
589
- function orientAgainst(normal, direction) {
590
- const facing = normal[0] * direction[0] + normal[1] * direction[1] + normal[2] * direction[2];
591
- return facing > 0 ? [-normal[0], -normal[1], -normal[2]] : normal;
592
- }
593
- function positiveFinite(value, name) {
594
- if (!Number.isFinite(value) || value <= 0) {
595
- throw new Error(`${name} must be a finite positive number.`);
596
- }
597
- return value;
598
- }
599
- function finiteOrZero(value) {
600
- return Number.isFinite(value) ? value : 0;
601
- }
602
- function moveToward(current, target, maxDelta) {
603
- const delta = target - current;
604
- if (Math.abs(delta) <= maxDelta) {
605
- return target;
606
- }
607
- return current + Math.sign(delta) * maxDelta;
608
- }
609
- //# sourceMappingURL=CharacterController.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CharacterController.js","sourceRoot":"","sources":["../../../../packages/physics/src/CharacterController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAgH,MAAM,oBAAoB,CAAC;AAGjK,OAAO,EAAE,KAAK,EAAE,aAAa,EAAa,MAAM,YAAY,CAAC;AAiF7D,MAAM,OAAO,2BAA2B;IAC7B,IAAI,CAAgB;IACpB,SAAS,CAAS;IAClB,WAAW,CAAS;IACpB,aAAa,CAAS;IACvB,KAAK,GAAqC,MAAM,CAAC;IAEzD,YAAY,aAAoD,EAAE;QAChE,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,UAAU,CAAC,SAAS,IAAI,UAAU,CAAC,QAAQ,IAAI,GAAG,EAAE,+BAA+B,CAAC,CAAC;QACrH,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,UAAU,CAAC,WAAW,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,EAAE,iCAAiC,CAAC,CAAC;QACtH,IAAI,CAAC,aAAa,GAAG,cAAc,CAAC,UAAU,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