@woosh/meep-engine 2.138.20 → 2.139.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/collection/PairUint32Map.d.ts +100 -0
- package/src/core/collection/PairUint32Map.d.ts.map +1 -0
- package/src/core/collection/PairUint32Map.js +321 -0
- package/src/core/collection/Uint32Map.d.ts +119 -0
- package/src/core/collection/Uint32Map.d.ts.map +1 -0
- package/src/core/collection/Uint32Map.js +345 -0
- package/src/core/collection/array/array_shuffle.d.ts +10 -3
- package/src/core/collection/array/array_shuffle.d.ts.map +1 -1
- package/src/core/collection/array/array_shuffle.js +27 -22
- package/src/core/collection/heap/FibonacciHeap.d.ts +195 -0
- package/src/core/collection/heap/FibonacciHeap.d.ts.map +1 -0
- package/src/core/collection/heap/FibonacciHeap.js +586 -0
- package/src/core/collection/heap/Uint32Heap.js +1 -1
- package/src/core/collection/heap/Uint32Heap4.d.ts +169 -0
- package/src/core/collection/heap/Uint32Heap4.d.ts.map +1 -0
- package/src/core/collection/heap/Uint32Heap4.js +490 -0
- package/src/core/geom/3d/line/line3_closest_points_segment_segment.d.ts +27 -0
- package/src/core/geom/3d/line/line3_closest_points_segment_segment.d.ts.map +1 -0
- package/src/core/geom/3d/line/line3_closest_points_segment_segment.js +88 -0
- package/src/core/geom/3d/shape/BoxShape3D.d.ts +61 -0
- package/src/core/geom/3d/shape/BoxShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/BoxShape3D.js +158 -0
- package/src/core/geom/3d/shape/CapsuleShape3D.d.ts +11 -0
- package/src/core/geom/3d/shape/CapsuleShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/CapsuleShape3D.js +12 -0
- package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts +37 -9
- package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitCubeShape3D.js +45 -98
- package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts +10 -0
- package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitSphereShape3D.js +11 -0
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.d.ts +61 -0
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.d.ts.map +1 -0
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.js +148 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedral_mesh_from_surface.d.ts +39 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedral_mesh_from_surface.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedral_mesh_from_surface.js +147 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedron_quality.d.ts +15 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedron_quality.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedron_quality.js +22 -0
- package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.d.ts +2 -0
- package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.js +673 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_carve_outside_surface.d.ts +26 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_carve_outside_surface.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_carve_outside_surface.js +222 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_around_edge.d.ts +34 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_around_edge.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_around_edge.js +146 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_23.d.ts +36 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_23.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_23.js +232 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_32.d.ts +33 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_32.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_32.js +255 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.d.ts +68 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.js +365 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts +31 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.js +112 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts +22 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.js +55 -0
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_quality.d.ts +32 -0
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_quality.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_quality.js +66 -0
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts +22 -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 +49 -0
- package/src/core/geom/3d/topology/struct/binary/BinaryTopology.d.ts +134 -0
- package/src/core/geom/3d/topology/struct/binary/BinaryTopology.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/BinaryTopology.js +276 -3
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts +17 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.js +135 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compact.d.ts +14 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compact.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compact.js +177 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple.js +20 -4
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.js +5 -3
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_create.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_create.js +9 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_get_or_create.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_get_or_create.js +21 -45
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill.js +7 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill_parallels.d.ts +8 -6
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill_parallels.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill_parallels.js +8 -6
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_kill_short_edges.d.ts +22 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_kill_short_edges.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_kill_short_edges.js +73 -0
- package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_vertex_replace.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_vertex_replace.js +51 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_get.d.ts +10 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_get.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_get.js +42 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_sample_interior_grid_points.d.ts +28 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_sample_interior_grid_points.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_sample_interior_grid_points.js +227 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_walk_boundary_loops.d.ts +13 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_walk_boundary_loops.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_walk_boundary_loops.js +108 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_query_edge_is_boundary.d.ts +11 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_query_edge_is_boundary.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_query_edge_is_boundary.js +20 -0
- package/src/core/geom/3d/triangle/triangle_mesh_compute_signed_volume.d.ts +20 -0
- package/src/core/geom/3d/triangle/triangle_mesh_compute_signed_volume.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/triangle_mesh_compute_signed_volume.js +38 -0
- package/src/core/graph/csr/CSRGraph.d.ts +168 -0
- package/src/core/graph/csr/CSRGraph.d.ts.map +1 -0
- package/src/core/graph/csr/CSRGraph.js +319 -0
- package/src/core/graph/metis/cluster_mesh_metis.d.ts +12 -0
- package/src/core/graph/metis/cluster_mesh_metis.d.ts.map +1 -1
- package/src/core/graph/metis/cluster_mesh_metis.js +12 -0
- package/src/core/graph/metis/metis.d.ts +19 -0
- package/src/core/graph/metis/metis.d.ts.map +1 -1
- package/src/core/graph/metis/metis.js +20 -0
- package/src/core/graph/metis/metis_cluster_bs.d.ts +11 -0
- package/src/core/graph/metis/metis_cluster_bs.d.ts.map +1 -1
- package/src/core/graph/metis/metis_cluster_bs.js +11 -0
- package/src/core/graph/metis/metis_options.d.ts +17 -2
- package/src/core/graph/metis/metis_options.d.ts.map +1 -1
- package/src/core/graph/metis/metis_options.js +17 -2
- package/src/core/graph/metis/native/MetisGraph.d.ts +144 -0
- package/src/core/graph/metis/native/MetisGraph.d.ts.map +1 -0
- package/src/core/graph/metis/native/MetisGraph.js +212 -0
- package/src/core/graph/metis/native/bisection/BisectionScratch.d.ts +72 -0
- package/src/core/graph/metis/native/bisection/BisectionScratch.d.ts.map +1 -0
- package/src/core/graph/metis/native/bisection/BisectionScratch.js +101 -0
- package/src/core/graph/metis/native/bisection/bisect_graph.d.ts +37 -0
- package/src/core/graph/metis/native/bisection/bisect_graph.d.ts.map +1 -0
- package/src/core/graph/metis/native/bisection/bisect_graph.js +100 -0
- package/src/core/graph/metis/native/bisection/compute_2way_params.d.ts +15 -0
- package/src/core/graph/metis/native/bisection/compute_2way_params.d.ts.map +1 -0
- package/src/core/graph/metis/native/bisection/compute_2way_params.js +84 -0
- package/src/core/graph/metis/native/bisection/fm_2way.d.ts +30 -0
- package/src/core/graph/metis/native/bisection/fm_2way.d.ts.map +1 -0
- package/src/core/graph/metis/native/bisection/fm_2way.js +290 -0
- package/src/core/graph/metis/native/bisection/grow_bisection.d.ts +23 -0
- package/src/core/graph/metis/native/bisection/grow_bisection.d.ts.map +1 -0
- package/src/core/graph/metis/native/bisection/grow_bisection.js +137 -0
- package/src/core/graph/metis/native/bisection/split_graph_two_way.d.ts +28 -0
- package/src/core/graph/metis/native/bisection/split_graph_two_way.d.ts.map +1 -0
- package/src/core/graph/metis/native/bisection/split_graph_two_way.js +119 -0
- package/src/core/graph/metis/native/coarsen/coarsen_graph.d.ts +20 -0
- package/src/core/graph/metis/native/coarsen/coarsen_graph.d.ts.map +1 -0
- package/src/core/graph/metis/native/coarsen/coarsen_graph.js +94 -0
- package/src/core/graph/metis/native/coarsen/create_coarse_graph.d.ts +24 -0
- package/src/core/graph/metis/native/coarsen/create_coarse_graph.d.ts.map +1 -0
- package/src/core/graph/metis/native/coarsen/create_coarse_graph.js +158 -0
- package/src/core/graph/metis/native/coarsen/match_shem.d.ts +41 -0
- package/src/core/graph/metis/native/coarsen/match_shem.d.ts.map +1 -0
- package/src/core/graph/metis/native/coarsen/match_shem.js +175 -0
- package/src/core/graph/metis/native/initial/initial_kway_bfs.d.ts +24 -0
- package/src/core/graph/metis/native/initial/initial_kway_bfs.d.ts.map +1 -0
- package/src/core/graph/metis/native/initial/initial_kway_bfs.js +122 -0
- package/src/core/graph/metis/native/initial/initial_kway_recursive_bisection.d.ts +29 -0
- package/src/core/graph/metis/native/initial/initial_kway_recursive_bisection.d.ts.map +1 -0
- package/src/core/graph/metis/native/initial/initial_kway_recursive_bisection.js +170 -0
- package/src/core/graph/metis/native/metis_partition_kway.d.ts +41 -0
- package/src/core/graph/metis/native/metis_partition_kway.d.ts.map +1 -0
- package/src/core/graph/metis/native/metis_partition_kway.js +126 -0
- package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.d.ts +62 -0
- package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.d.ts.map +1 -0
- package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.js +261 -0
- package/src/core/graph/metis/native/refine/RefinementScratch.d.ts +45 -0
- package/src/core/graph/metis/native/refine/RefinementScratch.d.ts.map +1 -0
- package/src/core/graph/metis/native/refine/RefinementScratch.js +53 -0
- package/src/core/graph/metis/native/refine/compute_kway_params.d.ts +18 -0
- package/src/core/graph/metis/native/refine/compute_kway_params.d.ts.map +1 -0
- package/src/core/graph/metis/native/refine/compute_kway_params.js +138 -0
- package/src/core/graph/metis/native/refine/fm_kway.d.ts +63 -0
- package/src/core/graph/metis/native/refine/fm_kway.d.ts.map +1 -0
- package/src/core/graph/metis/native/refine/fm_kway.js +462 -0
- package/src/core/graph/metis/native/refine/project_kway.d.ts +22 -0
- package/src/core/graph/metis/native/refine/project_kway.d.ts.map +1 -0
- package/src/core/graph/metis/native/refine/project_kway.js +43 -0
- package/src/core/graph/metis/native/refine/refine_kway.d.ts +34 -0
- package/src/core/graph/metis/native/refine/refine_kway.d.ts.map +1 -0
- package/src/core/graph/metis/native/refine/refine_kway.js +43 -0
- package/src/core/math/linalg/eigen/matrix_householder_in_place.d.ts +2 -2
- package/src/core/math/linalg/eigen/matrix_householder_in_place.js +2 -2
- package/src/core/math/linalg/eigen/matrix_qr_in_place.d.ts +6 -4
- package/src/core/math/linalg/eigen/matrix_qr_in_place.d.ts.map +1 -1
- package/src/core/math/linalg/eigen/matrix_qr_in_place.js +69 -23
- package/src/engine/EngineHarness.d.ts +3 -1
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +3 -0
- package/src/engine/control/first-person/DESIGN.md +30 -6
- package/src/engine/control/first-person/DESIGN_EXTENSIONS.md +563 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +102 -9
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerController.js +38 -3
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +533 -4
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +315 -6
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +220 -22
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +858 -241
- package/src/engine/control/first-person/TODO.md +127 -0
- package/src/engine/control/first-person/abilities/Ability.d.ts +101 -0
- package/src/engine/control/first-person/abilities/Ability.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/Ability.js +119 -0
- package/src/engine/control/first-person/abilities/AbilitySet.d.ts +86 -0
- package/src/engine/control/first-person/abilities/AbilitySet.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/AbilitySet.js +185 -0
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts +62 -0
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/LedgeGrab.js +199 -0
- package/src/engine/control/first-person/abilities/Mantle.d.ts +45 -0
- package/src/engine/control/first-person/abilities/Mantle.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/Mantle.js +188 -0
- package/src/engine/control/first-person/abilities/Slide.d.ts +33 -0
- package/src/engine/control/first-person/abilities/Slide.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/Slide.js +158 -0
- package/src/engine/control/first-person/abilities/WallJump.d.ts +45 -0
- package/src/engine/control/first-person/abilities/WallJump.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/WallJump.js +131 -0
- package/src/engine/control/first-person/abilities/WallRun.d.ts +44 -0
- package/src/engine/control/first-person/abilities/WallRun.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/WallRun.js +180 -0
- package/src/engine/control/first-person/composer/EyeOffsetStack.d.ts +49 -0
- package/src/engine/control/first-person/composer/EyeOffsetStack.d.ts.map +1 -0
- package/src/engine/control/first-person/composer/EyeOffsetStack.js +60 -0
- package/src/engine/control/first-person/mastery/BreathRhythmEvaluator.d.ts +100 -0
- package/src/engine/control/first-person/mastery/BreathRhythmEvaluator.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/BreathRhythmEvaluator.js +133 -0
- package/src/engine/control/first-person/mastery/DecisionPoint.d.ts +10 -0
- package/src/engine/control/first-person/mastery/DecisionPoint.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/DecisionPoint.js +30 -0
- package/src/engine/control/first-person/mastery/FootAsymmetryTurnEvaluator.d.ts +61 -0
- package/src/engine/control/first-person/mastery/FootAsymmetryTurnEvaluator.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/FootAsymmetryTurnEvaluator.js +109 -0
- package/src/engine/control/first-person/mastery/MasteryEvaluator.d.ts +40 -0
- package/src/engine/control/first-person/mastery/MasteryEvaluator.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/MasteryEvaluator.js +45 -0
- package/src/engine/control/first-person/mastery/MasteryScore.d.ts +68 -0
- package/src/engine/control/first-person/mastery/MasteryScore.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/MasteryScore.js +100 -0
- package/src/engine/control/first-person/mastery/MasterySet.d.ts +60 -0
- package/src/engine/control/first-person/mastery/MasterySet.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/MasterySet.js +86 -0
- package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.d.ts +58 -0
- package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.js +83 -0
- package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.d.ts +69 -0
- package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.js +109 -0
- package/src/engine/control/first-person/math/Spring.d.ts +56 -0
- package/src/engine/control/first-person/math/Spring.d.ts.map +1 -0
- package/src/engine/control/first-person/math/Spring.js +71 -0
- package/src/engine/control/first-person/math/computeLRCBreathRate.d.ts +26 -0
- package/src/engine/control/first-person/math/computeLRCBreathRate.d.ts.map +1 -0
- package/src/engine/control/first-person/math/computeLRCBreathRate.js +41 -0
- package/src/engine/control/first-person/math/computeMassRatios.d.ts +35 -0
- package/src/engine/control/first-person/math/computeMassRatios.d.ts.map +1 -0
- package/src/engine/control/first-person/math/computeMassRatios.js +44 -0
- package/src/engine/control/first-person/pose/FirstPersonPose.d.ts +31 -1
- package/src/engine/control/first-person/pose/FirstPersonPose.d.ts.map +1 -1
- package/src/engine/control/first-person/pose/FirstPersonPose.js +49 -3
- package/src/engine/control/first-person/pose/FirstPersonPosture.d.ts +7 -0
- package/src/engine/control/first-person/pose/FirstPersonPosture.d.ts.map +1 -0
- package/src/engine/control/first-person/pose/FirstPersonPosture.js +27 -0
- package/src/engine/control/first-person/prototype_first_person_controller.js +550 -119
- package/src/engine/control/first-person/sensors/FirstPersonSensors.d.ts +58 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensors.d.ts.map +1 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensors.js +77 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts +80 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +196 -0
- package/src/engine/control/first-person/test/buildTestPlayer.d.ts +20 -0
- package/src/engine/control/first-person/test/buildTestPlayer.d.ts.map +1 -0
- package/src/engine/control/first-person/test/buildTestPlayer.js +28 -0
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +0 -2
- package/src/engine/graphics/ecs/light/Light.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/Light.js +27 -0
- package/src/engine/graphics/ecs/light/LightSystem.js +1 -1
- package/src/engine/graphics/ecs/path/PathDisplaySystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +0 -2
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +0 -2
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -2
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +0 -2
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +0 -2
- package/src/engine/navigation/grid/find_path_on_grid_astar.d.ts.map +1 -1
- package/src/engine/navigation/grid/find_path_on_grid_astar.js +11 -2
- package/src/engine/navigation/mesh/bt_mesh_face_find_path.d.ts.map +1 -1
- package/src/engine/navigation/mesh/bt_mesh_face_find_path.js +11 -1
- package/src/engine/physics/PLAN.md +236 -0
- package/src/engine/physics/body/BodyStorage.d.ts +187 -0
- package/src/engine/physics/body/BodyStorage.d.ts.map +1 -0
- package/src/engine/physics/body/BodyStorage.js +427 -0
- package/src/engine/physics/broadphase/PairList.d.ts +62 -0
- package/src/engine/physics/broadphase/PairList.d.ts.map +1 -0
- package/src/engine/physics/broadphase/PairList.js +97 -0
- package/src/engine/physics/broadphase/aabb_transform_oriented.d.ts +30 -0
- package/src/engine/physics/broadphase/aabb_transform_oriented.d.ts.map +1 -0
- package/src/engine/physics/broadphase/aabb_transform_oriented.js +93 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts +16 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts.map +1 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.js +61 -0
- package/src/engine/physics/broadphase/generate_pairs.d.ts +38 -0
- package/src/engine/physics/broadphase/generate_pairs.d.ts.map +1 -0
- package/src/engine/physics/broadphase/generate_pairs.js +101 -0
- package/src/engine/physics/contact/ManifoldStore.d.ts +226 -0
- package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -0
- package/src/engine/physics/contact/ManifoldStore.js +499 -0
- package/src/engine/physics/ecs/BodyKind.d.ts +23 -0
- package/src/engine/physics/ecs/BodyKind.d.ts.map +1 -0
- package/src/engine/physics/ecs/BodyKind.js +24 -0
- package/src/engine/physics/ecs/Collider.d.ts +98 -0
- package/src/engine/physics/ecs/Collider.d.ts.map +1 -0
- package/src/engine/physics/ecs/Collider.js +136 -0
- package/src/engine/physics/ecs/ColliderFlags.d.ts +14 -0
- package/src/engine/physics/ecs/ColliderFlags.d.ts.map +1 -0
- package/src/engine/physics/ecs/ColliderFlags.js +15 -0
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts +58 -0
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts.map +1 -0
- package/src/engine/physics/ecs/ColliderObserverSystem.js +103 -0
- package/src/engine/physics/ecs/ColliderSerializationAdapter.d.ts +25 -0
- package/src/engine/physics/ecs/ColliderSerializationAdapter.d.ts.map +1 -0
- package/src/engine/physics/ecs/ColliderSerializationAdapter.js +37 -0
- package/src/engine/physics/ecs/PhysicsEvents.d.ts +15 -0
- package/src/engine/physics/ecs/PhysicsEvents.d.ts.map +1 -0
- package/src/engine/physics/ecs/PhysicsEvents.js +16 -0
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +520 -0
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -0
- package/src/engine/physics/ecs/PhysicsSystem.js +1159 -0
- package/src/engine/physics/ecs/RigidBody.d.ts +197 -0
- package/src/engine/physics/ecs/RigidBody.d.ts.map +1 -0
- package/src/engine/physics/ecs/RigidBody.js +240 -0
- package/src/engine/physics/ecs/RigidBodyFlags.d.ts +21 -0
- package/src/engine/physics/ecs/RigidBodyFlags.d.ts.map +1 -0
- package/src/engine/physics/ecs/RigidBodyFlags.js +22 -0
- package/src/engine/physics/ecs/RigidBodySerializationAdapter.d.ts +28 -0
- package/src/engine/physics/ecs/RigidBodySerializationAdapter.d.ts.map +1 -0
- package/src/engine/physics/ecs/RigidBodySerializationAdapter.js +81 -0
- package/src/engine/physics/ecs/SleepState.d.ts +11 -0
- package/src/engine/physics/ecs/SleepState.d.ts.map +1 -0
- package/src/engine/physics/ecs/SleepState.js +12 -0
- package/src/engine/physics/events/ContactEventBuffer.d.ts +46 -0
- package/src/engine/physics/events/ContactEventBuffer.d.ts.map +1 -0
- package/src/engine/physics/events/ContactEventBuffer.js +83 -0
- package/src/engine/physics/events/diff_manifolds.d.ts +25 -0
- package/src/engine/physics/events/diff_manifolds.d.ts.map +1 -0
- package/src/engine/physics/events/diff_manifolds.js +50 -0
- package/src/engine/physics/fluid/FluidField.d.ts +294 -16
- package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidField.js +510 -66
- package/src/engine/physics/fluid/FluidSimulator.d.ts +188 -5
- package/src/engine/physics/fluid/FluidSimulator.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidSimulator.js +455 -95
- package/src/engine/physics/fluid/SliceVisualiser.d.ts +29 -6
- package/src/engine/physics/fluid/SliceVisualiser.d.ts.map +1 -1
- package/src/engine/physics/fluid/SliceVisualiser.js +190 -165
- package/src/engine/physics/fluid/ecs/FluidComponent.d.ts +154 -0
- package/src/engine/physics/fluid/ecs/FluidComponent.d.ts.map +1 -0
- package/src/engine/physics/fluid/ecs/FluidComponent.js +238 -0
- package/src/engine/physics/fluid/ecs/FluidEffectorsComponent.d.ts +45 -0
- package/src/engine/physics/fluid/ecs/FluidEffectorsComponent.d.ts.map +1 -0
- package/src/engine/physics/fluid/ecs/FluidEffectorsComponent.js +89 -0
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +107 -0
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts.map +1 -0
- package/src/engine/physics/fluid/ecs/FluidSystem.js +278 -0
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +62 -1
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +81 -6
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts +17 -4
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +105 -12
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts +43 -0
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts.map +1 -0
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.js +210 -0
- package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts +62 -1
- package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/WakeFluidEffector.js +302 -8
- package/src/engine/physics/fluid/prototype.js +102 -91
- package/src/engine/physics/fluid/solver/optimal_sor_omega.d.ts +33 -0
- package/src/engine/physics/fluid/solver/optimal_sor_omega.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/optimal_sor_omega.js +41 -0
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.d.ts +20 -5
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.js +60 -38
- package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.d.ts +25 -4
- package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.js +93 -73
- package/src/engine/physics/fluid/solver/v3_grid_apply_scalar_advection.d.ts +23 -0
- package/src/engine/physics/fluid/solver/v3_grid_apply_scalar_advection.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_apply_scalar_advection.js +60 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_divergence.d.ts +23 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_divergence.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_divergence.js +68 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts +30 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.js +66 -0
- package/src/engine/physics/fluid/solver/v3_grid_patch_edges_uniform.d.ts +26 -0
- package/src/engine/physics/fluid/solver/v3_grid_patch_edges_uniform.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_patch_edges_uniform.js +113 -0
- package/src/engine/physics/fluid/solver/v3_grid_shift_in_place.d.ts +30 -0
- package/src/engine/physics/fluid/solver/v3_grid_shift_in_place.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_shift_in_place.js +107 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts +49 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.js +126 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts +93 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.js +424 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.d.ts +20 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.js +83 -0
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts +26 -0
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.js +70 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts.map +1 -1
- package/src/engine/physics/gjk/expanding_polytope_algorithm.js +8 -10
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts +29 -0
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -0
- package/src/engine/physics/inertia/world_inverse_inertia.js +79 -0
- package/src/engine/physics/integration/integrate_position.d.ts +16 -0
- package/src/engine/physics/integration/integrate_position.d.ts.map +1 -0
- package/src/engine/physics/integration/integrate_position.js +48 -0
- package/src/engine/physics/integration/integrate_velocity.d.ts +25 -0
- package/src/engine/physics/integration/integrate_velocity.d.ts.map +1 -0
- package/src/engine/physics/integration/integrate_velocity.js +79 -0
- package/src/engine/physics/integration/quat_integrate.d.ts +27 -0
- package/src/engine/physics/integration/quat_integrate.d.ts.map +1 -0
- package/src/engine/physics/integration/quat_integrate.js +62 -0
- package/src/engine/physics/island/IslandBuilder.d.ts +167 -0
- package/src/engine/physics/island/IslandBuilder.d.ts.map +1 -0
- package/src/engine/physics/island/IslandBuilder.js +411 -0
- package/src/engine/physics/island/union_find.d.ts +51 -0
- package/src/engine/physics/island/union_find.d.ts.map +1 -0
- package/src/engine/physics/island/union_find.js +76 -0
- package/src/engine/physics/narrowphase/PosedShape.d.ts +59 -0
- package/src/engine/physics/narrowphase/PosedShape.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/PosedShape.js +110 -0
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts +32 -0
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/box_box_manifold.js +543 -0
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts +122 -0
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/capsule_contacts.js +508 -0
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts +11 -0
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/narrowphase_step.js +382 -0
- package/src/engine/physics/narrowphase/sphere_box_contact.d.ts +38 -0
- package/src/engine/physics/narrowphase/sphere_box_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/sphere_box_contact.js +130 -0
- package/src/engine/physics/narrowphase/sphere_sphere_contact.d.ts +26 -0
- package/src/engine/physics/narrowphase/sphere_sphere_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/sphere_sphere_contact.js +51 -0
- package/src/engine/physics/queries/PhysicsSurfacePoint.d.ts +83 -0
- package/src/engine/physics/queries/PhysicsSurfacePoint.d.ts.map +1 -0
- package/src/engine/physics/queries/PhysicsSurfacePoint.js +100 -0
- package/src/engine/physics/queries/raycast.d.ts +20 -0
- package/src/engine/physics/queries/raycast.d.ts.map +1 -0
- package/src/engine/physics/queries/raycast.js +249 -0
- package/src/engine/physics/solver/friction_cone.d.ts +16 -0
- package/src/engine/physics/solver/friction_cone.d.ts.map +1 -0
- package/src/engine/physics/solver/friction_cone.js +37 -0
- package/src/engine/physics/solver/solve_contacts.d.ts +36 -0
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -0
- package/src/engine/physics/solver/solve_contacts.js +598 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.d.ts +0 -34
- package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.js +0 -66
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.d.ts +0 -2
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.js +0 -54
- package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.d.ts +0 -2
- package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.js +0 -26
- package/src/engine/ecs/components/Motion.d.ts +0 -21
- package/src/engine/ecs/components/Motion.d.ts.map +0 -1
- package/src/engine/ecs/components/Motion.js +0 -27
- package/src/engine/ecs/components/MotionSerializationAdapter.d.ts +0 -20
- package/src/engine/ecs/components/MotionSerializationAdapter.d.ts.map +0 -1
- package/src/engine/ecs/components/MotionSerializationAdapter.js +0 -26
- package/src/engine/ecs/systems/MotionSystem.d.ts +0 -9
- package/src/engine/ecs/systems/MotionSystem.d.ts.map +0 -1
- package/src/engine/ecs/systems/MotionSystem.js +0 -29
- package/src/engine/physics/fluid/Fluid.d.ts +0 -26
- package/src/engine/physics/fluid/Fluid.d.ts.map +0 -1
- package/src/engine/physics/fluid/Fluid.js +0 -221
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_reverse.d.ts +0 -7
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_reverse.d.ts.map +0 -1
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_reverse.js +0 -8
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result of a {@link PhysicsSystem} query that resolves to a single surface
|
|
3
|
+
* contact — raycast hit, sphere overlap nearest-point, shape-cast first
|
|
4
|
+
* blocker, etc.
|
|
5
|
+
*
|
|
6
|
+
* The class is an *output parameter*: callers pre-allocate one (or pull one
|
|
7
|
+
* from a frame-pool) and pass it into the query. The query writes the fields
|
|
8
|
+
* on hit and returns `true`; on miss it returns `false` and leaves the
|
|
9
|
+
* fields untouched.
|
|
10
|
+
*
|
|
11
|
+
* Pre-allocation matters because a query that gets called every frame (a
|
|
12
|
+
* ground sensor, a hover beam) would otherwise drop a small object on the
|
|
13
|
+
* GC per call. Reusing the same `PhysicsSurfacePoint` keeps that allocation
|
|
14
|
+
* out of the hot path.
|
|
15
|
+
*
|
|
16
|
+
* Field layout chosen to match what gameplay code typically needs:
|
|
17
|
+
* - `position` — world-space point on the surface
|
|
18
|
+
* - `normal` — surface normal at that point (broadphase queries return
|
|
19
|
+
* the AABB face normal as an approximation; narrowphase-refined queries
|
|
20
|
+
* would return the true shape normal at the same call site)
|
|
21
|
+
* - `t` — distance along the input ray, sphere-cast, etc. Useful when the
|
|
22
|
+
* caller wants to interpolate or step along the query primitive
|
|
23
|
+
* (`origin + t·direction` reconstructs the hit point exactly without
|
|
24
|
+
* reading `position`, which the deferred-execution physics events bus
|
|
25
|
+
* would otherwise need to copy).
|
|
26
|
+
* - `entity` — entity id that owns the hit body
|
|
27
|
+
* - `body_id` — packed body id (index << 8 | generation); stale after the
|
|
28
|
+
* body is unlinked, so prefer `entity` for any cross-frame retention.
|
|
29
|
+
*
|
|
30
|
+
* @author Alex Goldring
|
|
31
|
+
* @copyright Company Named Limited (c) 2026
|
|
32
|
+
*/
|
|
33
|
+
export class PhysicsSurfacePoint {
|
|
34
|
+
/**
|
|
35
|
+
* World-space point on the hit surface.
|
|
36
|
+
* @readonly
|
|
37
|
+
* @type {Vector3}
|
|
38
|
+
*/
|
|
39
|
+
readonly position: Vector3;
|
|
40
|
+
/**
|
|
41
|
+
* Surface normal at {@link position}, unit length. For broadphase-only
|
|
42
|
+
* queries this is the AABB face normal (axis-aligned), which is exact
|
|
43
|
+
* for AABB-shaped colliders and a stable approximation otherwise.
|
|
44
|
+
* @readonly
|
|
45
|
+
* @type {Vector3}
|
|
46
|
+
*/
|
|
47
|
+
readonly normal: Vector3;
|
|
48
|
+
/**
|
|
49
|
+
* Parametric distance from the query origin to {@link position}, in
|
|
50
|
+
* the same units as the input direction's magnitude (so for a unit-
|
|
51
|
+
* length ray direction this is metres).
|
|
52
|
+
* @type {number}
|
|
53
|
+
*/
|
|
54
|
+
t: number;
|
|
55
|
+
/**
|
|
56
|
+
* Entity that owns the hit body, or `-1` if no body owns it.
|
|
57
|
+
* @type {number}
|
|
58
|
+
*/
|
|
59
|
+
entity: number;
|
|
60
|
+
/**
|
|
61
|
+
* Packed body id (index << 8 | generation). Goes stale once the body
|
|
62
|
+
* is unlinked from the {@link PhysicsSystem}; prefer {@link entity}
|
|
63
|
+
* for any cross-frame use.
|
|
64
|
+
* @type {number}
|
|
65
|
+
*/
|
|
66
|
+
body_id: number;
|
|
67
|
+
/**
|
|
68
|
+
* Reset to a "no hit" state. Optional — the query convention is that the
|
|
69
|
+
* fields are only meaningful when the call returns `true`, so callers
|
|
70
|
+
* that always branch on the return value don't need to reset. Useful for
|
|
71
|
+
* debugger inspection and for tests that want to verify the query
|
|
72
|
+
* doesn't accidentally touch the result on miss.
|
|
73
|
+
*/
|
|
74
|
+
reset(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Fast type-check marker.
|
|
77
|
+
* @readonly
|
|
78
|
+
* @type {boolean}
|
|
79
|
+
*/
|
|
80
|
+
readonly isPhysicsSurfacePoint: boolean;
|
|
81
|
+
}
|
|
82
|
+
import Vector3 from "../../../core/geom/Vector3.js";
|
|
83
|
+
//# sourceMappingURL=PhysicsSurfacePoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhysicsSurfacePoint.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/queries/PhysicsSurfacePoint.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;IAGQ;;;;OAIG;IACH,mBAFU,OAAO,CAEY;IAE7B;;;;;;OAMG;IACH,iBAFU,OAAO,CAEU;IAE3B;;;;;OAKG;IACH,GAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,QAFU,MAAM,CAEA;IAEhB;;;;;OAKG;IACH,SAFU,MAAM,CAEC;IAGrB;;;;;;OAMG;IACH,cAQC;IAGL;;;;OAIG;IACH,gCAFU,OAAO,CAEkC;CAPlD;oBA5FmB,+BAA+B"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import Vector3 from "../../../core/geom/Vector3.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Result of a {@link PhysicsSystem} query that resolves to a single surface
|
|
5
|
+
* contact — raycast hit, sphere overlap nearest-point, shape-cast first
|
|
6
|
+
* blocker, etc.
|
|
7
|
+
*
|
|
8
|
+
* The class is an *output parameter*: callers pre-allocate one (or pull one
|
|
9
|
+
* from a frame-pool) and pass it into the query. The query writes the fields
|
|
10
|
+
* on hit and returns `true`; on miss it returns `false` and leaves the
|
|
11
|
+
* fields untouched.
|
|
12
|
+
*
|
|
13
|
+
* Pre-allocation matters because a query that gets called every frame (a
|
|
14
|
+
* ground sensor, a hover beam) would otherwise drop a small object on the
|
|
15
|
+
* GC per call. Reusing the same `PhysicsSurfacePoint` keeps that allocation
|
|
16
|
+
* out of the hot path.
|
|
17
|
+
*
|
|
18
|
+
* Field layout chosen to match what gameplay code typically needs:
|
|
19
|
+
* - `position` — world-space point on the surface
|
|
20
|
+
* - `normal` — surface normal at that point (broadphase queries return
|
|
21
|
+
* the AABB face normal as an approximation; narrowphase-refined queries
|
|
22
|
+
* would return the true shape normal at the same call site)
|
|
23
|
+
* - `t` — distance along the input ray, sphere-cast, etc. Useful when the
|
|
24
|
+
* caller wants to interpolate or step along the query primitive
|
|
25
|
+
* (`origin + t·direction` reconstructs the hit point exactly without
|
|
26
|
+
* reading `position`, which the deferred-execution physics events bus
|
|
27
|
+
* would otherwise need to copy).
|
|
28
|
+
* - `entity` — entity id that owns the hit body
|
|
29
|
+
* - `body_id` — packed body id (index << 8 | generation); stale after the
|
|
30
|
+
* body is unlinked, so prefer `entity` for any cross-frame retention.
|
|
31
|
+
*
|
|
32
|
+
* @author Alex Goldring
|
|
33
|
+
* @copyright Company Named Limited (c) 2026
|
|
34
|
+
*/
|
|
35
|
+
export class PhysicsSurfacePoint {
|
|
36
|
+
|
|
37
|
+
constructor() {
|
|
38
|
+
/**
|
|
39
|
+
* World-space point on the hit surface.
|
|
40
|
+
* @readonly
|
|
41
|
+
* @type {Vector3}
|
|
42
|
+
*/
|
|
43
|
+
this.position = new Vector3();
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Surface normal at {@link position}, unit length. For broadphase-only
|
|
47
|
+
* queries this is the AABB face normal (axis-aligned), which is exact
|
|
48
|
+
* for AABB-shaped colliders and a stable approximation otherwise.
|
|
49
|
+
* @readonly
|
|
50
|
+
* @type {Vector3}
|
|
51
|
+
*/
|
|
52
|
+
this.normal = new Vector3();
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Parametric distance from the query origin to {@link position}, in
|
|
56
|
+
* the same units as the input direction's magnitude (so for a unit-
|
|
57
|
+
* length ray direction this is metres).
|
|
58
|
+
* @type {number}
|
|
59
|
+
*/
|
|
60
|
+
this.t = 0;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Entity that owns the hit body, or `-1` if no body owns it.
|
|
64
|
+
* @type {number}
|
|
65
|
+
*/
|
|
66
|
+
this.entity = -1;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Packed body id (index << 8 | generation). Goes stale once the body
|
|
70
|
+
* is unlinked from the {@link PhysicsSystem}; prefer {@link entity}
|
|
71
|
+
* for any cross-frame use.
|
|
72
|
+
* @type {number}
|
|
73
|
+
*/
|
|
74
|
+
this.body_id = -1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Reset to a "no hit" state. Optional — the query convention is that the
|
|
79
|
+
* fields are only meaningful when the call returns `true`, so callers
|
|
80
|
+
* that always branch on the return value don't need to reset. Useful for
|
|
81
|
+
* debugger inspection and for tests that want to verify the query
|
|
82
|
+
* doesn't accidentally touch the result on miss.
|
|
83
|
+
*/
|
|
84
|
+
reset() {
|
|
85
|
+
const p = this.position;
|
|
86
|
+
const n = this.normal;
|
|
87
|
+
p[0] = 0; p[1] = 0; p[2] = 0;
|
|
88
|
+
n[0] = 0; n[1] = 0; n[2] = 0;
|
|
89
|
+
this.t = 0;
|
|
90
|
+
this.entity = -1;
|
|
91
|
+
this.body_id = -1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Fast type-check marker.
|
|
97
|
+
* @readonly
|
|
98
|
+
* @type {boolean}
|
|
99
|
+
*/
|
|
100
|
+
PhysicsSurfacePoint.prototype.isPhysicsSurfacePoint = true;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raycast against both broadphase trees (static + dynamic) of a
|
|
3
|
+
* {@link PhysicsSystem}, filling `result` with the nearest hit and returning
|
|
4
|
+
* `true` on hit, `false` on miss.
|
|
5
|
+
*
|
|
6
|
+
* Hit normal is the AABB face normal — exact for AABB-shaped colliders,
|
|
7
|
+
* a stable approximation for general convex shapes (an upcoming narrowphase
|
|
8
|
+
* refinement pass will replace this with the true shape normal at the same
|
|
9
|
+
* call site, no API change).
|
|
10
|
+
*
|
|
11
|
+
* @param {PhysicsSystem} system
|
|
12
|
+
* @param {Ray3} ray origin + unit direction + `tMax`
|
|
13
|
+
* @param {PhysicsSurfacePoint} result populated on hit; untouched on miss
|
|
14
|
+
* @param {(entity:number, collider:Collider)=>boolean} [filter] mandatory in
|
|
15
|
+
* contract; defaults to {@link returnTrue} (accept everything). Called once
|
|
16
|
+
* per BVH leaf that crosses the ray.
|
|
17
|
+
* @returns {boolean} true on hit, false on miss
|
|
18
|
+
*/
|
|
19
|
+
export function raycast(system: PhysicsSystem, ray: Ray3, result: PhysicsSurfacePoint, filter?: (entity: number, collider: Collider) => boolean): boolean;
|
|
20
|
+
//# sourceMappingURL=raycast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raycast.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/queries/raycast.js"],"names":[],"mappings":"AA2HA;;;;;;;;;;;;;;;;;GAiBG;AACH,yGALmB,MAAM,yBAAsB,OAAO,GAGzC,OAAO,CA6GnB"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../core/collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
2
|
+
import {
|
|
3
|
+
COLUMN_CHILD_1,
|
|
4
|
+
COLUMN_CHILD_2,
|
|
5
|
+
COLUMN_USER_DATA,
|
|
6
|
+
ELEMENT_WORD_COUNT,
|
|
7
|
+
NULL_NODE,
|
|
8
|
+
} from "../../../core/bvh2/bvh3/BVH.js";
|
|
9
|
+
import { returnTrue } from "../../../core/function/returnTrue.js";
|
|
10
|
+
import { aabb3_near_distance_to_intersection_ray_segment } from "../../../core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.js";
|
|
11
|
+
|
|
12
|
+
const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Walk a single BVH along a ray and update the running nearest hit.
|
|
16
|
+
*
|
|
17
|
+
* Hit refinement is broadphase-only: the returned `t` is the distance to
|
|
18
|
+
* the inflated leaf AABB. Narrowphase shape refinement is a follow-up.
|
|
19
|
+
*
|
|
20
|
+
* @param {BVH} bvh
|
|
21
|
+
* @param {number} root
|
|
22
|
+
* @param {number} ox
|
|
23
|
+
* @param {number} oy
|
|
24
|
+
* @param {number} oz
|
|
25
|
+
* @param {number} dx
|
|
26
|
+
* @param {number} dy
|
|
27
|
+
* @param {number} dz
|
|
28
|
+
* @param {number} inv_dx
|
|
29
|
+
* @param {number} inv_dy
|
|
30
|
+
* @param {number} inv_dz
|
|
31
|
+
* @param {number} max_distance
|
|
32
|
+
* @param {{best_t:number, best_body:number, best_node:number, best_bvh:BVH|null}} acc
|
|
33
|
+
* @param {(body_id:number)=>boolean} test per-leaf filter
|
|
34
|
+
*/
|
|
35
|
+
function bvh_raycast_nearest(
|
|
36
|
+
bvh, root,
|
|
37
|
+
ox, oy, oz,
|
|
38
|
+
dx, dy, dz,
|
|
39
|
+
inv_dx, inv_dy, inv_dz,
|
|
40
|
+
max_distance,
|
|
41
|
+
acc,
|
|
42
|
+
test
|
|
43
|
+
) {
|
|
44
|
+
if (root === NULL_NODE) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const float32 = bvh.__data_float32;
|
|
49
|
+
const uint32 = bvh.__data_uint32;
|
|
50
|
+
|
|
51
|
+
let pointer = stack.pointer;
|
|
52
|
+
const stack_top = pointer;
|
|
53
|
+
stack[pointer++] = root;
|
|
54
|
+
|
|
55
|
+
while (pointer > stack_top) {
|
|
56
|
+
pointer--;
|
|
57
|
+
const node = stack[pointer];
|
|
58
|
+
const address = node * ELEMENT_WORD_COUNT;
|
|
59
|
+
|
|
60
|
+
const t_near = aabb3_near_distance_to_intersection_ray_segment(
|
|
61
|
+
float32[address], float32[address + 1], float32[address + 2],
|
|
62
|
+
float32[address + 3], float32[address + 4], float32[address + 5],
|
|
63
|
+
ox, oy, oz,
|
|
64
|
+
inv_dx, inv_dy, inv_dz,
|
|
65
|
+
0, max_distance
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// No intersection or this subtree can't beat the best known hit — prune.
|
|
69
|
+
if (t_near >= acc.best_t) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const child_1 = uint32[address + COLUMN_CHILD_1];
|
|
74
|
+
if (child_1 !== NULL_NODE) {
|
|
75
|
+
stack[pointer++] = uint32[address + COLUMN_CHILD_2];
|
|
76
|
+
stack[pointer++] = child_1;
|
|
77
|
+
} else {
|
|
78
|
+
const body_id = uint32[address + COLUMN_USER_DATA];
|
|
79
|
+
if (test(body_id)) {
|
|
80
|
+
acc.best_t = t_near;
|
|
81
|
+
acc.best_body = body_id;
|
|
82
|
+
acc.best_node = node;
|
|
83
|
+
acc.best_bvh = bvh;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
stack.pointer = stack_top;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Reusable nearest-hit accumulator. Module-scoped so {@link raycast} doesn't
|
|
93
|
+
* allocate per call. The physics step is single-threaded so contention isn't
|
|
94
|
+
* a concern.
|
|
95
|
+
* @type {{best_t:number, best_body:number, best_node:number, best_bvh:BVH|null}}
|
|
96
|
+
*/
|
|
97
|
+
const acc = { best_t: Infinity, best_body: 0, best_node: 0, best_bvh: null };
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Reusable closure bound to the current system + user filter so we don't
|
|
101
|
+
* allocate a new function object per call. Re-wired at the top of each
|
|
102
|
+
* {@link raycast} invocation. The BVH traversal sees a stable identity
|
|
103
|
+
* which helps V8 keep the call site monomorphic.
|
|
104
|
+
*
|
|
105
|
+
* Carries state via the module-scoped `bound_*` slots below.
|
|
106
|
+
* @type {(body_id:number)=>boolean}
|
|
107
|
+
*/
|
|
108
|
+
const bound_test = (body_id) => {
|
|
109
|
+
const system = bound_system;
|
|
110
|
+
const entity = system.entityOf(body_id);
|
|
111
|
+
if (entity < 0) return false;
|
|
112
|
+
// v1 limitation: when a multi-collider body's BVH leaf is hit, we pass
|
|
113
|
+
// the body's primary (first-attached) collider rather than the specific
|
|
114
|
+
// collider the ray actually crossed. Sufficient for entity-level
|
|
115
|
+
// filtering; per-collider filtering needs the BVH user_data scheme to
|
|
116
|
+
// encode collider index too — future work.
|
|
117
|
+
const collider = system.__primary_collider(system.__index_of(body_id));
|
|
118
|
+
return bound_filter(entity, collider);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
let bound_system = null;
|
|
122
|
+
let bound_filter = returnTrue;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Raycast against both broadphase trees (static + dynamic) of a
|
|
126
|
+
* {@link PhysicsSystem}, filling `result` with the nearest hit and returning
|
|
127
|
+
* `true` on hit, `false` on miss.
|
|
128
|
+
*
|
|
129
|
+
* Hit normal is the AABB face normal — exact for AABB-shaped colliders,
|
|
130
|
+
* a stable approximation for general convex shapes (an upcoming narrowphase
|
|
131
|
+
* refinement pass will replace this with the true shape normal at the same
|
|
132
|
+
* call site, no API change).
|
|
133
|
+
*
|
|
134
|
+
* @param {PhysicsSystem} system
|
|
135
|
+
* @param {Ray3} ray origin + unit direction + `tMax`
|
|
136
|
+
* @param {PhysicsSurfacePoint} result populated on hit; untouched on miss
|
|
137
|
+
* @param {(entity:number, collider:Collider)=>boolean} [filter] mandatory in
|
|
138
|
+
* contract; defaults to {@link returnTrue} (accept everything). Called once
|
|
139
|
+
* per BVH leaf that crosses the ray.
|
|
140
|
+
* @returns {boolean} true on hit, false on miss
|
|
141
|
+
*/
|
|
142
|
+
export function raycast(system, ray, result, filter = returnTrue) {
|
|
143
|
+
const ox = ray.origin_x;
|
|
144
|
+
const oy = ray.origin_y;
|
|
145
|
+
const oz = ray.origin_z;
|
|
146
|
+
const dx = ray.direction_x;
|
|
147
|
+
const dy = ray.direction_y;
|
|
148
|
+
const dz = ray.direction_z;
|
|
149
|
+
const max_distance = ray.tMax;
|
|
150
|
+
|
|
151
|
+
acc.best_t = max_distance;
|
|
152
|
+
acc.best_body = 0;
|
|
153
|
+
acc.best_node = 0;
|
|
154
|
+
acc.best_bvh = null;
|
|
155
|
+
|
|
156
|
+
bound_system = system;
|
|
157
|
+
bound_filter = filter;
|
|
158
|
+
|
|
159
|
+
const inv_dx = 1 / dx;
|
|
160
|
+
const inv_dy = 1 / dy;
|
|
161
|
+
const inv_dz = 1 / dz;
|
|
162
|
+
|
|
163
|
+
bvh_raycast_nearest(
|
|
164
|
+
system.staticBvh, system.staticBvh.root,
|
|
165
|
+
ox, oy, oz,
|
|
166
|
+
dx, dy, dz,
|
|
167
|
+
inv_dx, inv_dy, inv_dz,
|
|
168
|
+
max_distance,
|
|
169
|
+
acc, bound_test
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
bvh_raycast_nearest(
|
|
173
|
+
system.dynamicBvh, system.dynamicBvh.root,
|
|
174
|
+
ox, oy, oz,
|
|
175
|
+
dx, dy, dz,
|
|
176
|
+
inv_dx, inv_dy, inv_dz,
|
|
177
|
+
max_distance,
|
|
178
|
+
acc, bound_test
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
if (acc.best_bvh === null || acc.best_t >= max_distance) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const entity = system.entityOf(acc.best_body);
|
|
186
|
+
if (entity < 0) {
|
|
187
|
+
// Body was unlinked concurrently; treat as a miss.
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Hit position in world space.
|
|
192
|
+
const t = acc.best_t;
|
|
193
|
+
const hx = ox + dx * t;
|
|
194
|
+
const hy = oy + dy * t;
|
|
195
|
+
const hz = oz + dz * t;
|
|
196
|
+
|
|
197
|
+
// AABB face normal at the hit point. Read the best leaf's AABB back from
|
|
198
|
+
// its BVH; project the hit point into the AABB's normalised local space
|
|
199
|
+
// (centre = 0, faces = ±1); the dominant component is the entry-face
|
|
200
|
+
// axis, its sign gives the outward normal.
|
|
201
|
+
const bvh = acc.best_bvh;
|
|
202
|
+
const node_address = acc.best_node * ELEMENT_WORD_COUNT;
|
|
203
|
+
const f32 = bvh.__data_float32;
|
|
204
|
+
const aabb_min_x = f32[node_address];
|
|
205
|
+
const aabb_min_y = f32[node_address + 1];
|
|
206
|
+
const aabb_min_z = f32[node_address + 2];
|
|
207
|
+
const aabb_max_x = f32[node_address + 3];
|
|
208
|
+
const aabb_max_y = f32[node_address + 4];
|
|
209
|
+
const aabb_max_z = f32[node_address + 5];
|
|
210
|
+
|
|
211
|
+
const cx = (aabb_min_x + aabb_max_x) * 0.5;
|
|
212
|
+
const cy = (aabb_min_y + aabb_max_y) * 0.5;
|
|
213
|
+
const cz = (aabb_min_z + aabb_max_z) * 0.5;
|
|
214
|
+
// Multiplicative inverse of the half-extent saves one divide per axis.
|
|
215
|
+
// A degenerate AABB (zero extent on an axis) is impossible for live BVH
|
|
216
|
+
// leaves — physics shapes always have non-zero bounding extent.
|
|
217
|
+
const inv_half_x = 2 / (aabb_max_x - aabb_min_x);
|
|
218
|
+
const inv_half_y = 2 / (aabb_max_y - aabb_min_y);
|
|
219
|
+
const inv_half_z = 2 / (aabb_max_z - aabb_min_z);
|
|
220
|
+
|
|
221
|
+
const px = (hx - cx) * inv_half_x;
|
|
222
|
+
const py = (hy - cy) * inv_half_y;
|
|
223
|
+
const pz = (hz - cz) * inv_half_z;
|
|
224
|
+
|
|
225
|
+
const apx = px < 0 ? -px : px;
|
|
226
|
+
const apy = py < 0 ? -py : py;
|
|
227
|
+
const apz = pz < 0 ? -pz : pz;
|
|
228
|
+
|
|
229
|
+
let nx, ny, nz;
|
|
230
|
+
if (apx >= apy && apx >= apz) {
|
|
231
|
+
nx = px >= 0 ? 1 : -1; ny = 0; nz = 0;
|
|
232
|
+
} else if (apy >= apz) {
|
|
233
|
+
nx = 0; ny = py >= 0 ? 1 : -1; nz = 0;
|
|
234
|
+
} else {
|
|
235
|
+
nx = 0; ny = 0; nz = pz >= 0 ? 1 : -1;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Fill result. Direct typed-array writes — Vector3 extends Float32Array,
|
|
239
|
+
// and there are no observers subscribed to a query-result vector.
|
|
240
|
+
const rp = result.position;
|
|
241
|
+
const rn = result.normal;
|
|
242
|
+
rp[0] = hx; rp[1] = hy; rp[2] = hz;
|
|
243
|
+
rn[0] = nx; rn[1] = ny; rn[2] = nz;
|
|
244
|
+
result.t = t;
|
|
245
|
+
result.entity = entity;
|
|
246
|
+
result.body_id = acc.best_body;
|
|
247
|
+
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clamp a 2D friction impulse `(jt1, jt2)` to a disk of radius `max_magnitude`
|
|
3
|
+
* — the Coulomb friction cone projected onto the tangent plane.
|
|
4
|
+
*
|
|
5
|
+
* The 2-axis joint clamp avoids the "friction stronger along one tangent than
|
|
6
|
+
* along the other" anisotropy that comes from clamping each tangent axis
|
|
7
|
+
* independently. Standard Box2D / Bullet recipe.
|
|
8
|
+
*
|
|
9
|
+
* @param {number[]|Float64Array} out length >= 2; receives the clamped (jt1, jt2)
|
|
10
|
+
* @param {number} out_offset
|
|
11
|
+
* @param {number} jt1
|
|
12
|
+
* @param {number} jt2
|
|
13
|
+
* @param {number} max_magnitude must be >= 0
|
|
14
|
+
*/
|
|
15
|
+
export function friction_cone_clamp(out: number[] | Float64Array, out_offset: number, jt1: number, jt2: number, max_magnitude: number): void;
|
|
16
|
+
//# sourceMappingURL=friction_cone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"friction_cone.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/solver/friction_cone.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,yCANW,MAAM,EAAE,GAAC,YAAY,cACrB,MAAM,OACN,MAAM,OACN,MAAM,iBACN,MAAM,QAwBhB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clamp a 2D friction impulse `(jt1, jt2)` to a disk of radius `max_magnitude`
|
|
3
|
+
* — the Coulomb friction cone projected onto the tangent plane.
|
|
4
|
+
*
|
|
5
|
+
* The 2-axis joint clamp avoids the "friction stronger along one tangent than
|
|
6
|
+
* along the other" anisotropy that comes from clamping each tangent axis
|
|
7
|
+
* independently. Standard Box2D / Bullet recipe.
|
|
8
|
+
*
|
|
9
|
+
* @param {number[]|Float64Array} out length >= 2; receives the clamped (jt1, jt2)
|
|
10
|
+
* @param {number} out_offset
|
|
11
|
+
* @param {number} jt1
|
|
12
|
+
* @param {number} jt2
|
|
13
|
+
* @param {number} max_magnitude must be >= 0
|
|
14
|
+
*/
|
|
15
|
+
export function friction_cone_clamp(out, out_offset, jt1, jt2, max_magnitude) {
|
|
16
|
+
if (max_magnitude <= 0) {
|
|
17
|
+
// No friction budget available (typical when normal impulse is zero):
|
|
18
|
+
// force the tangent impulse to zero so the solver doesn't add motion
|
|
19
|
+
// out of nothing.
|
|
20
|
+
out[out_offset] = 0;
|
|
21
|
+
out[out_offset + 1] = 0;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const mag_sqr = jt1 * jt1 + jt2 * jt2;
|
|
26
|
+
const max_sqr = max_magnitude * max_magnitude;
|
|
27
|
+
|
|
28
|
+
if (mag_sqr <= max_sqr) {
|
|
29
|
+
out[out_offset] = jt1;
|
|
30
|
+
out[out_offset + 1] = jt2;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const scale = max_magnitude / Math.sqrt(mag_sqr);
|
|
35
|
+
out[out_offset] = jt1 * scale;
|
|
36
|
+
out[out_offset + 1] = jt2 * scale;
|
|
37
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sequential-impulse contact solver. Partitions the touched contact set into
|
|
3
|
+
* islands (via {@link IslandBuilder}, owned by the PhysicsSystem and rebuilt
|
|
4
|
+
* upstream in the pipeline), then iterates each island independently.
|
|
5
|
+
*
|
|
6
|
+
* Per-island iteration matters for two reasons:
|
|
7
|
+
* 1. Impulse propagation converges inside an island without waiting for
|
|
8
|
+
* unrelated bodies' Gauss-Seidel updates from previous outer loops.
|
|
9
|
+
* 2. Disconnected awake bodies don't pay each other's solver cost — adding
|
|
10
|
+
* an unrelated active body to the scene scales O(island_size) rather than
|
|
11
|
+
* O(global_active).
|
|
12
|
+
*
|
|
13
|
+
* Coulomb friction is applied as a disk clamp in the contact tangent plane.
|
|
14
|
+
* Position correction is folded into the velocity solve via Baumgarte bias.
|
|
15
|
+
*
|
|
16
|
+
* The `apply_warm_start` flag gates the warm-start impulse application.
|
|
17
|
+
* In a classic PGS call (one solve per tick), pass `true` (default) — the
|
|
18
|
+
* cached impulses from the previous tick get replayed onto the velocity,
|
|
19
|
+
* seeding the iterations near the converged answer. In TGS substepping,
|
|
20
|
+
* the PhysicsSystem calls this once per substep; only substep 0 should
|
|
21
|
+
* apply warm-start, because subsequent substeps continue from the solver
|
|
22
|
+
* state left by the previous substep (the impulses in `data` already
|
|
23
|
+
* reflect the current velocity, so re-applying them would double-count).
|
|
24
|
+
*
|
|
25
|
+
* Inertial: angular response uses the full world-frame inverse inertia
|
|
26
|
+
* `R · diag(I⁻¹_local) · R^T` via {@link world_inverse_inertia_apply},
|
|
27
|
+
* correct for arbitrary rotations + diagonal local inertia.
|
|
28
|
+
*
|
|
29
|
+
* @param {ManifoldStore} manifolds
|
|
30
|
+
* @param {PhysicsSystem} system PhysicsSystem; reads `system.islands`.
|
|
31
|
+
* @param {number} dt step duration (full tick `dt` for PGS, sub-tick for TGS)
|
|
32
|
+
* @param {number} [iters]
|
|
33
|
+
* @param {boolean} [apply_warm_start]
|
|
34
|
+
*/
|
|
35
|
+
export function solve_contacts(manifolds: ManifoldStore, system: PhysicsSystem, dt: number, iters?: number, apply_warm_start?: boolean): void;
|
|
36
|
+
//# sourceMappingURL=solve_contacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solve_contacts.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/solver/solve_contacts.js"],"names":[],"mappings":"AAyQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,oFAJW,MAAM,UACN,MAAM,qBACN,OAAO,QAoBjB"}
|