@woosh/meep-engine 2.139.0 → 2.141.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/query/bvh_query_user_data_overlaps_aabb.d.ts +3 -3
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.js +4 -4
- package/src/{engine/physics/broadphase/aabb_transform_oriented.d.ts → core/geom/3d/aabb/aabb3_transform_oriented.d.ts} +2 -2
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts.map +1 -0
- package/src/{engine/physics/broadphase/aabb_transform_oriented.js → core/geom/3d/aabb/aabb3_transform_oriented.js} +1 -1
- package/src/core/geom/3d/quaternion/quat3_multiply.d.ts +21 -0
- package/src/core/geom/3d/quaternion/quat3_multiply.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_multiply.js +25 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts +54 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.js +69 -0
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts +24 -2
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/AbstractShape3D.js +24 -1
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts +148 -0
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/HeightMapShape3D.js +451 -0
- package/src/core/geom/3d/shape/MeshShape3D.d.ts +210 -0
- package/src/core/geom/3d/shape/MeshShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/MeshShape3D.js +593 -0
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/TransformedShape3D.js +46 -2
- package/src/core/geom/3d/shape/Triangle3D.d.ts +95 -0
- package/src/core/geom/3d/shape/Triangle3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/Triangle3D.js +318 -0
- package/src/core/geom/3d/shape/UnionShape3D.js +13 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts +30 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts.map +1 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.js +64 -0
- package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.js +9 -11
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts +28 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.js +48 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.js +40 -18
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts +9 -5
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.js +38 -10
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts +14 -5
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.js +47 -5
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts +19 -0
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.js +75 -13
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts +2 -2
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts.map +1 -1
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.js +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_dot_array_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.js +2 -2
- package/src/core/geom/vec3/v3_negate_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_negate_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_negate_array.js +2 -2
- package/src/core/geom/vec3/v3_quat3_apply.d.ts +29 -0
- package/src/core/geom/vec3/v3_quat3_apply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_quat3_apply.js +39 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts +30 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.js +41 -0
- package/src/core/geom/vec3/v3_triple_cross_product.d.ts +32 -0
- package/src/core/geom/vec3/v3_triple_cross_product.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_triple_cross_product.js +45 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +16 -3
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerController.js +211 -211
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +72 -8
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +37 -5
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +101 -3
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +1789 -1416
- package/src/engine/control/first-person/TODO.md +173 -127
- package/src/engine/control/first-person/abilities/Slide.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/Slide.js +9 -1
- package/src/engine/control/first-person/prototype_first_person_controller.js +88 -2
- package/src/engine/control/first-person/test/buildTestPlayer.d.ts.map +1 -1
- package/src/engine/control/first-person/test/buildTestPlayer.js +9 -1
- package/src/engine/graphics/geometry/CapsuleGeometry.d.ts +42 -0
- package/src/engine/graphics/geometry/CapsuleGeometry.d.ts.map +1 -0
- package/src/engine/graphics/geometry/CapsuleGeometry.js +171 -0
- package/src/engine/physics/BULLET_REVIEW.md +945 -0
- package/src/engine/physics/CANNON_REVIEW.md +1300 -0
- package/src/engine/physics/JOLT_REVIEW.md +913 -0
- package/src/engine/physics/PLAN.md +578 -236
- package/src/engine/physics/RAPIER_REVIEW.md +934 -0
- package/src/engine/physics/REVIEW_001_ACTION_PLAN.md +642 -0
- package/src/engine/physics/REVIEW_002.md +151 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.js +2 -2
- package/src/engine/physics/constraint/DofMode.d.ts +28 -0
- package/src/engine/physics/constraint/DofMode.d.ts.map +1 -0
- package/src/engine/physics/constraint/DofMode.js +35 -0
- package/src/engine/physics/constraint/solve_constraints.d.ts +16 -0
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -0
- package/src/engine/physics/constraint/solve_constraints.js +436 -0
- package/src/engine/physics/contact/ManifoldStore.d.ts +83 -10
- package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
- package/src/engine/physics/contact/ManifoldStore.js +608 -499
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts +2 -2
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/Joint.d.ts +179 -0
- package/src/engine/physics/ecs/Joint.d.ts.map +1 -0
- package/src/engine/physics/ecs/Joint.js +234 -0
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +180 -20
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +1423 -1159
- package/src/engine/physics/fluid/FluidField.d.ts +14 -10
- package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidField.js +14 -10
- package/src/engine/physics/fluid/FluidSimulator.js +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts +17 -10
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.js +18 -11
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts +13 -10
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.js +18 -13
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts +4 -3
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.js +15 -11
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts +30 -6
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.js +44 -18
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts +6 -6
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts.map +1 -1
- package/src/engine/physics/gjk/expanding_polytope_algorithm.js +68 -22
- package/src/engine/physics/gjk/gjk.d.ts +28 -2
- package/src/engine/physics/gjk/gjk.d.ts.map +1 -1
- package/src/engine/physics/gjk/gjk.js +421 -378
- package/src/engine/physics/gjk/minkowski_support.d.ts +37 -0
- package/src/engine/physics/gjk/minkowski_support.d.ts.map +1 -0
- package/src/engine/physics/gjk/minkowski_support.js +75 -0
- package/src/engine/physics/gjk/mpr.d.ts +56 -0
- package/src/engine/physics/gjk/mpr.d.ts.map +1 -0
- package/src/engine/physics/gjk/mpr.js +344 -0
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts +20 -5
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -1
- package/src/engine/physics/inertia/world_inverse_inertia.js +36 -38
- package/src/engine/physics/integration/integrate_position.d.ts +25 -7
- package/src/engine/physics/integration/integrate_position.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_position.js +43 -12
- package/src/engine/physics/integration/integrate_velocity.d.ts +30 -0
- package/src/engine/physics/integration/integrate_velocity.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_velocity.js +82 -1
- package/src/engine/physics/island/IslandBuilder.d.ts +4 -1
- package/src/engine/physics/island/IslandBuilder.d.ts.map +1 -1
- package/src/engine/physics/island/IslandBuilder.js +33 -16
- package/src/engine/physics/narrowphase/PosedShape.d.ts +0 -8
- package/src/engine/physics/narrowphase/PosedShape.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/PosedShape.js +28 -30
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/box_box_manifold.js +140 -18
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts +30 -0
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/box_triangle_contact.js +811 -0
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/capsule_contacts.js +10 -56
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts +71 -0
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/capsule_triangle_contact.js +375 -0
- package/src/engine/physics/narrowphase/compute_penetration.d.ts +91 -0
- package/src/engine/physics/narrowphase/compute_penetration.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/compute_penetration.js +396 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts +35 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.js +80 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts +31 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.js +55 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts +42 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.js +204 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts +42 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.js +94 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts +37 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.js +37 -0
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts +41 -2
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +1497 -382
- package/src/engine/physics/narrowphase/sphere_box_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/sphere_box_contact.js +16 -23
- package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts +48 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.js +143 -0
- package/src/engine/physics/queries/overlap_shape.d.ts +51 -0
- package/src/engine/physics/queries/overlap_shape.d.ts.map +1 -0
- package/src/engine/physics/queries/overlap_shape.js +183 -0
- package/src/engine/physics/queries/shape_cast.d.ts +56 -0
- package/src/engine/physics/queries/shape_cast.d.ts.map +1 -0
- package/src/engine/physics/queries/shape_cast.js +387 -0
- package/src/engine/physics/solver/solve_contacts.d.ts +146 -32
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -1
- package/src/engine/physics/solver/solve_contacts.js +809 -223
- package/src/engine/physics/broadphase/aabb_transform_oriented.d.ts.map +0 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.d.ts +0 -20
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.d.ts.map +0 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.js +0 -83
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
export class PhysicsSystem extends System<any, any, any, any, any> {
|
|
19
19
|
constructor();
|
|
20
20
|
dependencies: (typeof Transform | typeof RigidBody)[];
|
|
21
|
-
components_used: (ResourceAccessSpecification<typeof
|
|
21
|
+
components_used: (ResourceAccessSpecification<typeof RigidBody> | ResourceAccessSpecification<typeof Collider> | ResourceAccessSpecification<typeof Transform>)[];
|
|
22
22
|
/**
|
|
23
23
|
* @type {BodyStorage}
|
|
24
24
|
*/
|
|
@@ -66,34 +66,36 @@ export class PhysicsSystem extends System<any, any, any, any, any> {
|
|
|
66
66
|
*/
|
|
67
67
|
sleepVelocitySqrThreshold: number;
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
69
|
+
* Seconds of below-threshold motion before a body is moved to the
|
|
70
|
+
* sleeping set. Box2D default is 0.5 s.
|
|
71
|
+
* @type {number}
|
|
72
|
+
*/
|
|
73
|
+
sleepTimeThreshold: number;
|
|
74
|
+
/**
|
|
75
|
+
* Number of TGS substeps per `fixedUpdate`. Each substep re-runs the
|
|
76
|
+
* velocity + position solve at `dt / substeps` against contacts whose
|
|
77
|
+
* penetration is re-derived analytically from the bodies' moved poses
|
|
78
|
+
* — narrowphase still runs once per outer step. Higher counts buy
|
|
79
|
+
* stack stability, high-mass-ratio robustness, and smoother
|
|
80
|
+
* trajectories at a near-linear solver cost (sleeping islands are
|
|
81
|
+
* unaffected — they never enter the loop).
|
|
76
82
|
*
|
|
77
|
-
*
|
|
78
|
-
* classic PGS behaviour (one solve per tick at full `dt`).
|
|
83
|
+
* `1` reproduces the non-substepped (single-step) solve.
|
|
79
84
|
* @type {number}
|
|
80
85
|
*/
|
|
81
|
-
|
|
86
|
+
substeps: number;
|
|
82
87
|
/**
|
|
83
|
-
* Velocity iterations
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* across substeps with position integration between them, which
|
|
87
|
-
* is dramatically more stable on stacks.
|
|
88
|
+
* Velocity iterations per substep. Lower than a single-step solver
|
|
89
|
+
* would need, because the substep loop revisits the contact set
|
|
90
|
+
* `substeps` times.
|
|
88
91
|
* @type {number}
|
|
89
92
|
*/
|
|
90
|
-
|
|
93
|
+
velocityIterations: number;
|
|
91
94
|
/**
|
|
92
|
-
*
|
|
93
|
-
* sleeping set. Box2D default is 0.5 s.
|
|
95
|
+
* Position (split-impulse) iterations per substep.
|
|
94
96
|
* @type {number}
|
|
95
97
|
*/
|
|
96
|
-
|
|
98
|
+
positionIterations: number;
|
|
97
99
|
/**
|
|
98
100
|
* Reusable contact-event payload. Listeners must copy any fields they
|
|
99
101
|
* intend to retain past their own scope. Reset before each dispatch.
|
|
@@ -155,6 +157,45 @@ export class PhysicsSystem extends System<any, any, any, any, any> {
|
|
|
155
157
|
entity: number;
|
|
156
158
|
bvhNode: number;
|
|
157
159
|
}>>;
|
|
160
|
+
/**
|
|
161
|
+
* Live {@link Joint} (6-DOF constraint) instances, in a sparse array
|
|
162
|
+
* indexed by joint id. Solved alongside contacts inside the TGS
|
|
163
|
+
* substep loop. Holes (unlinked joints) are `undefined`.
|
|
164
|
+
* @type {Joint[]}
|
|
165
|
+
*/
|
|
166
|
+
__joints: Joint[];
|
|
167
|
+
/**
|
|
168
|
+
* Lowest free index in {@link __joints} for slot reuse on link.
|
|
169
|
+
* @private
|
|
170
|
+
* @type {number}
|
|
171
|
+
*/
|
|
172
|
+
private __joint_free;
|
|
173
|
+
/**
|
|
174
|
+
* Velocity iterations per substep for the joint solver. Joints (and
|
|
175
|
+
* especially joint chains) want a few more iterations than contacts to
|
|
176
|
+
* propagate impulses along the chain; cheap because joints are far
|
|
177
|
+
* fewer than contacts.
|
|
178
|
+
* @type {number}
|
|
179
|
+
*/
|
|
180
|
+
jointIterations: number;
|
|
181
|
+
/**
|
|
182
|
+
* Per-body pseudo-velocity for the Catto split-impulse position
|
|
183
|
+
* pass (TGS Phase 1). Flat layout, 6 doubles per body slot index:
|
|
184
|
+
* `[lin.x, lin.y, lin.z, ang.x, ang.y, ang.z]`. Sized to
|
|
185
|
+
* `storage.high_water_mark * 6` at the top of each fixedUpdate
|
|
186
|
+
* and zeroed in place so unwritten slots contribute nothing to
|
|
187
|
+
* `integrate_position`.
|
|
188
|
+
*
|
|
189
|
+
* The solver writes during its position pass; `integrate_position`
|
|
190
|
+
* reads and folds into the pose update on the same tick, then
|
|
191
|
+
* the next tick's zero-pass wipes the state. It NEVER lands in
|
|
192
|
+
* `linearVelocity` / `angularVelocity` — that's the point of
|
|
193
|
+
* split impulse: depth correction does not contaminate persistent
|
|
194
|
+
* velocity (so a `restitution = 0` impact stops cleanly).
|
|
195
|
+
*
|
|
196
|
+
* @type {Float64Array}
|
|
197
|
+
*/
|
|
198
|
+
__pseudo_velocity: Float64Array;
|
|
158
199
|
/**
|
|
159
200
|
* Bound reference to {@link __pair_filter} so we hand the same
|
|
160
201
|
* callable to {@link generate_pairs} each step without per-step
|
|
@@ -188,6 +229,18 @@ export class PhysicsSystem extends System<any, any, any, any, any> {
|
|
|
188
229
|
* @returns {Collider|null}
|
|
189
230
|
*/
|
|
190
231
|
private __primary_collider;
|
|
232
|
+
/**
|
|
233
|
+
* Resize {@link __pseudo_velocity} to cover every live body slot and
|
|
234
|
+
* zero its contents. Called at the top of each fixedUpdate so the
|
|
235
|
+
* split-impulse position pass starts from a clean state — bodies the
|
|
236
|
+
* solver doesn't touch contribute zero pseudo-velocity to
|
|
237
|
+
* {@link integrate_position}.
|
|
238
|
+
*
|
|
239
|
+
* Doubles on growth like the other physics scratches; never shrinks.
|
|
240
|
+
*
|
|
241
|
+
* @private
|
|
242
|
+
*/
|
|
243
|
+
private __reset_pseudo_velocity;
|
|
191
244
|
/**
|
|
192
245
|
* Replace the world gravity vector. Effective on the next step.
|
|
193
246
|
* @param {Vector3|{x:number,y:number,z:number}} v
|
|
@@ -273,6 +326,23 @@ export class PhysicsSystem extends System<any, any, any, any, any> {
|
|
|
273
326
|
* @returns {number} body index or -1
|
|
274
327
|
*/
|
|
275
328
|
private __find_body_index_by_entity;
|
|
329
|
+
/**
|
|
330
|
+
* Register a {@link Joint} (6-DOF constraint). Resolves the joint's
|
|
331
|
+
* entities to packed body ids and adds it to the active set, where it is
|
|
332
|
+
* solved alongside contacts in the TGS substep loop. Body A must be a
|
|
333
|
+
* linked body; body B is either a linked body or {@link JOINT_WORLD}
|
|
334
|
+
* (anchoring A to a fixed world point — `localAnchorB` is then a world
|
|
335
|
+
* coordinate).
|
|
336
|
+
*
|
|
337
|
+
* @param {Joint} joint
|
|
338
|
+
*/
|
|
339
|
+
link_joint(joint: Joint): void;
|
|
340
|
+
/**
|
|
341
|
+
* Remove a previously {@link link_joint}'d joint from the active set.
|
|
342
|
+
* Idempotent.
|
|
343
|
+
* @param {Joint} joint
|
|
344
|
+
*/
|
|
345
|
+
unlink_joint(joint: Joint): void;
|
|
276
346
|
/**
|
|
277
347
|
* Resolve a packed body id to its entity, or `-1` if the id is stale.
|
|
278
348
|
* @param {number} packed_body_id
|
|
@@ -444,6 +514,82 @@ export class PhysicsSystem extends System<any, any, any, any, any> {
|
|
|
444
514
|
* @returns {boolean}
|
|
445
515
|
*/
|
|
446
516
|
raycast(ray: Ray3, result: PhysicsSurfacePoint, filter?: (entity: number, collider: Collider) => boolean): boolean;
|
|
517
|
+
/**
|
|
518
|
+
* Sweep a convex shape along a ray and find the first body it
|
|
519
|
+
* would hit. The shape starts at `ray.origin` oriented by
|
|
520
|
+
* `rotation` and translates along `ray.direction` for up to
|
|
521
|
+
* `ray.tMax` units. Returns the nearest impact within that
|
|
522
|
+
* interval.
|
|
523
|
+
*
|
|
524
|
+
* The "swept AABB" broadphase finds candidate bodies whose BVH
|
|
525
|
+
* leaves overlap the shape's swept volume; the narrowphase then
|
|
526
|
+
* bisects [0, t] on GJK overlap to find the time-of-impact for
|
|
527
|
+
* each candidate. Best-t early termination skips candidates that
|
|
528
|
+
* can't tighten the answer.
|
|
529
|
+
*
|
|
530
|
+
* @param {Ray3} ray origin + unit direction + `tMax`
|
|
531
|
+
* @param {AbstractShape3D} shape
|
|
532
|
+
* @param {{x:number,y:number,z:number,w:number}} rotation
|
|
533
|
+
* @param {PhysicsSurfacePoint} result populated on hit; untouched on miss
|
|
534
|
+
* @param {(entity:number, collider:Collider)=>boolean} [filter]
|
|
535
|
+
* @returns {boolean}
|
|
536
|
+
*/
|
|
537
|
+
shapeCast(ray: Ray3, shape: AbstractShape3D, rotation: {
|
|
538
|
+
x: number;
|
|
539
|
+
y: number;
|
|
540
|
+
z: number;
|
|
541
|
+
w: number;
|
|
542
|
+
}, result: PhysicsSurfacePoint, filter?: (entity: number, collider: Collider) => boolean): boolean;
|
|
543
|
+
/**
|
|
544
|
+
* Speculative overlap query: find all bodies whose collider would
|
|
545
|
+
* overlap the given convex shape placed at the given world pose,
|
|
546
|
+
* without mutating the simulation. Intended for kinematic /
|
|
547
|
+
* character controllers that need to test "would I collide if I
|
|
548
|
+
* moved here?" before committing the move.
|
|
549
|
+
*
|
|
550
|
+
* Pipeline:
|
|
551
|
+
* 1. The shape's world AABB is computed from `position` + `rotation`.
|
|
552
|
+
* 2. Both broadphase trees (static + dynamic) are queried for
|
|
553
|
+
* bodies whose leaf AABB overlaps that envelope.
|
|
554
|
+
* 3. Each candidate is GJK-tested in world frame. Convex
|
|
555
|
+
* candidates run one GJK call; concave candidates (heightmap,
|
|
556
|
+
* mesh) run per-triangle GJK via the decomposition path.
|
|
557
|
+
* 4. The optional `filter` is consulted before the GJK test —
|
|
558
|
+
* useful for skipping the caller's own body, allies, sensors,
|
|
559
|
+
* etc.
|
|
560
|
+
*
|
|
561
|
+
* The output buffer is filled with overlapping bodies' `body_id`
|
|
562
|
+
* values (uint32 with packed generation), starting at
|
|
563
|
+
* `output_offset`. The caller is responsible for sizing the buffer;
|
|
564
|
+
* IDs past its end are dropped silently and the count caps at the
|
|
565
|
+
* available space.
|
|
566
|
+
*
|
|
567
|
+
* The query shape must be convex. Concave query shapes throw —
|
|
568
|
+
* they're typically static terrain and not used as kinematic
|
|
569
|
+
* probes; the M×N triangle-pair cost wouldn't be worth the rare
|
|
570
|
+
* use case.
|
|
571
|
+
*
|
|
572
|
+
* @param {AbstractShape3D} shape convex query shape, in its local frame
|
|
573
|
+
* @param {{x:number,y:number,z:number}} position world position of
|
|
574
|
+
* the query shape
|
|
575
|
+
* @param {{x:number,y:number,z:number,w:number}} rotation world
|
|
576
|
+
* rotation (unit quaternion)
|
|
577
|
+
* @param {Uint32Array|number[]} output buffer to receive body_ids
|
|
578
|
+
* @param {number} output_offset starting index in output
|
|
579
|
+
* @param {(entity:number, collider:Collider)=>boolean} [filter]
|
|
580
|
+
* defaults to {@link returnTrue}
|
|
581
|
+
* @returns {number} number of overlapping bodies written
|
|
582
|
+
*/
|
|
583
|
+
overlap(shape: AbstractShape3D, position: {
|
|
584
|
+
x: number;
|
|
585
|
+
y: number;
|
|
586
|
+
z: number;
|
|
587
|
+
}, rotation: {
|
|
588
|
+
x: number;
|
|
589
|
+
y: number;
|
|
590
|
+
z: number;
|
|
591
|
+
w: number;
|
|
592
|
+
}, output: Uint32Array | number[], output_offset: number, filter?: (entity: number, collider: Collider) => boolean): number;
|
|
447
593
|
/**
|
|
448
594
|
* Run one simulation step. v1 pipeline: integrate velocity → integrate
|
|
449
595
|
* position → refit broadphase AABBs. Narrowphase, solver, islands and
|
|
@@ -459,6 +605,20 @@ export class PhysicsSystem extends System<any, any, any, any, any> {
|
|
|
459
605
|
* @private
|
|
460
606
|
*/
|
|
461
607
|
private __wake_pairs;
|
|
608
|
+
/**
|
|
609
|
+
* Wake propagation across joints: if a joint connects an awake body to a
|
|
610
|
+
* sleeping one, wake the sleeper so the constraint stays coupled (a joint
|
|
611
|
+
* with one body asleep and one awake would otherwise be skipped by the
|
|
612
|
+
* solver, letting the awake side drift). A common trigger is a
|
|
613
|
+
* kinematic/motor-driven body pulling on a sleeping chain.
|
|
614
|
+
*
|
|
615
|
+
* Bodies that slept together as one island share a sleep group, so the
|
|
616
|
+
* usual atomic wake already revives the whole chain when any member is
|
|
617
|
+
* hit; this catches the cases that atomic wake doesn't (joint spanning
|
|
618
|
+
* separate groups, kinematic driver).
|
|
619
|
+
* @private
|
|
620
|
+
*/
|
|
621
|
+
private __wake_joints;
|
|
462
622
|
/**
|
|
463
623
|
* Per-island atomic sleep test. Walks each island once and applies the
|
|
464
624
|
* decision uniformly across all members:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhysicsSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/ecs/PhysicsSystem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PhysicsSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/ecs/PhysicsSystem.js"],"names":[],"mappings":"AA+DA;;;;;;;;;;;;;;;;GAgBG;AACH;IAEI,cA6NC;IA1NG,sDAA0C;IAE1C,kKAIC;IAED;;OAEG;IACH,SAFU,WAAW,CAEW;IAEhC;;OAEG;IACH,WAFU,GAAG,CAEa;IAE1B;;OAEG;IACH,YAFU,GAAG,CAEc;IAE3B;;;OAGG;IACH,WAFU,aAAa,CAEa;IAEpC;;;;OAIG;IACH,OAFU,QAAQ,CAES;IAE3B;;;;OAIG;IACH,eAFU,kBAAkB,CAEiB;IAE7C;;;;;;;OAOG;IACH,SAFU,aAAa,CAEW;IAElC;;;;;;OAMG;IACH,2BAFU,MAAM,CAEqB;IAErC;;;;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