@woosh/meep-engine 2.138.19 → 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 +2 -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 +6 -4
- 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/ecs/EntityManager.d.ts +2 -2
- package/src/engine/ecs/EntityManager.d.ts.map +1 -1
- package/src/engine/ecs/EntityManager.js +13 -8
- package/src/engine/ecs/System.d.ts.map +1 -1
- package/src/engine/ecs/System.js +2 -2
- 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,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single spatial-query result. Set fields when `hit` is true; ignore them
|
|
3
|
+
* otherwise. `surfaceTag` is optional — populated by future surface-tag
|
|
4
|
+
* systems (grass/wood/metal/etc.) so abilities and audio can react to the
|
|
5
|
+
* material.
|
|
6
|
+
*/
|
|
7
|
+
export class SensorHit {
|
|
8
|
+
hit: boolean;
|
|
9
|
+
/** Distance from query origin to contact point (meters). */
|
|
10
|
+
distance: number;
|
|
11
|
+
/** World-space contact point. */
|
|
12
|
+
point: Vector3;
|
|
13
|
+
/** Surface normal at contact (unit vector, points away from surface). */
|
|
14
|
+
normal: Vector3;
|
|
15
|
+
/** Optional material/surface tag — e.g. "grass", "metal". */
|
|
16
|
+
surfaceTag: any;
|
|
17
|
+
/** Reset to "no hit" — call before re-using the slot each tick. */
|
|
18
|
+
clear(): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Cached spatial-query results for one first-person controller. Populated
|
|
22
|
+
* by {@link FirstPersonSensorsSystem} once per fixed step, read by
|
|
23
|
+
* abilities and (where useful) by the base controller.
|
|
24
|
+
*
|
|
25
|
+
* The point of cacheing is dedup: mantle and ledge-grab both want a
|
|
26
|
+
* "forward + up obstacle probe". Compute once, both read the cached hit.
|
|
27
|
+
*
|
|
28
|
+
* Sensor slots cleared each tick before population. Abilities should
|
|
29
|
+
* treat any `hit === false` slot as "absent" — never read distance/point
|
|
30
|
+
* when hit is false (they're stale or zero, depending on clear-mode).
|
|
31
|
+
*
|
|
32
|
+
* @author Alex Goldring
|
|
33
|
+
* @copyright Company Named Limited (c) 2026
|
|
34
|
+
*/
|
|
35
|
+
export class FirstPersonSensors {
|
|
36
|
+
/** Wall to the body-local left, probed at chest height. */
|
|
37
|
+
wallLeft: SensorHit;
|
|
38
|
+
/** Wall to the body-local right, probed at chest height. */
|
|
39
|
+
wallRight: SensorHit;
|
|
40
|
+
/** Wall directly in front of the body. */
|
|
41
|
+
wallFront: SensorHit;
|
|
42
|
+
/**
|
|
43
|
+
* Obstacle ahead at chest/waist height — used by mantle/vault.
|
|
44
|
+
* Distance is along the body's forward direction; normal is the
|
|
45
|
+
* face of the obstacle the player is approaching.
|
|
46
|
+
*/
|
|
47
|
+
obstacleAhead: SensorHit;
|
|
48
|
+
/**
|
|
49
|
+
* Ledge edge ahead — for ledge grab. Populated when the forward
|
|
50
|
+
* obstacle probe hits and a downward probe just past the
|
|
51
|
+
* obstacle's top finds empty space, indicating a grabbable edge.
|
|
52
|
+
*/
|
|
53
|
+
ledgeAhead: SensorHit;
|
|
54
|
+
/** Clear all sensor slots — call at the start of each tick. */
|
|
55
|
+
clearAll(): void;
|
|
56
|
+
}
|
|
57
|
+
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
58
|
+
//# sourceMappingURL=FirstPersonSensors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FirstPersonSensors.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/control/first-person/sensors/FirstPersonSensors.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH;IAEQ,aAAgB;IAChB,4DAA4D;IAC5D,iBAAiB;IACjB,iCAAiC;IACjC,eAA0B;IAC1B,yEAAyE;IACzE,gBAAkC;IAClC,6DAA6D;IAC7D,gBAAsB;IAG1B,mEAAmE;IACnE,cAMC;CACJ;AAED;;;;;;;;;;;;;;GAcG;AACH;IAEQ,2DAA2D;IAC3D,oBAA+B;IAC/B,4DAA4D;IAC5D,qBAAgC;IAChC,0CAA0C;IAC1C,qBAAgC;IAChC;;;;OAIG;IACH,yBAAoC;IACpC;;;;OAIG;IACH,sBAAiC;IAGrC,+DAA+D;IAC/D,iBAMC;CACJ;oBA5EmB,kCAAkC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Single spatial-query result. Set fields when `hit` is true; ignore them
|
|
5
|
+
* otherwise. `surfaceTag` is optional — populated by future surface-tag
|
|
6
|
+
* systems (grass/wood/metal/etc.) so abilities and audio can react to the
|
|
7
|
+
* material.
|
|
8
|
+
*/
|
|
9
|
+
export class SensorHit {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.hit = false;
|
|
12
|
+
/** Distance from query origin to contact point (meters). */
|
|
13
|
+
this.distance = 0;
|
|
14
|
+
/** World-space contact point. */
|
|
15
|
+
this.point = new Vector3();
|
|
16
|
+
/** Surface normal at contact (unit vector, points away from surface). */
|
|
17
|
+
this.normal = new Vector3(0, 1, 0);
|
|
18
|
+
/** Optional material/surface tag — e.g. "grass", "metal". */
|
|
19
|
+
this.surfaceTag = null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Reset to "no hit" — call before re-using the slot each tick. */
|
|
23
|
+
clear() {
|
|
24
|
+
this.hit = false;
|
|
25
|
+
this.distance = 0;
|
|
26
|
+
this.point.set(0, 0, 0);
|
|
27
|
+
this.normal.set(0, 1, 0);
|
|
28
|
+
this.surfaceTag = null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Cached spatial-query results for one first-person controller. Populated
|
|
34
|
+
* by {@link FirstPersonSensorsSystem} once per fixed step, read by
|
|
35
|
+
* abilities and (where useful) by the base controller.
|
|
36
|
+
*
|
|
37
|
+
* The point of cacheing is dedup: mantle and ledge-grab both want a
|
|
38
|
+
* "forward + up obstacle probe". Compute once, both read the cached hit.
|
|
39
|
+
*
|
|
40
|
+
* Sensor slots cleared each tick before population. Abilities should
|
|
41
|
+
* treat any `hit === false` slot as "absent" — never read distance/point
|
|
42
|
+
* when hit is false (they're stale or zero, depending on clear-mode).
|
|
43
|
+
*
|
|
44
|
+
* @author Alex Goldring
|
|
45
|
+
* @copyright Company Named Limited (c) 2026
|
|
46
|
+
*/
|
|
47
|
+
export class FirstPersonSensors {
|
|
48
|
+
constructor() {
|
|
49
|
+
/** Wall to the body-local left, probed at chest height. */
|
|
50
|
+
this.wallLeft = new SensorHit();
|
|
51
|
+
/** Wall to the body-local right, probed at chest height. */
|
|
52
|
+
this.wallRight = new SensorHit();
|
|
53
|
+
/** Wall directly in front of the body. */
|
|
54
|
+
this.wallFront = new SensorHit();
|
|
55
|
+
/**
|
|
56
|
+
* Obstacle ahead at chest/waist height — used by mantle/vault.
|
|
57
|
+
* Distance is along the body's forward direction; normal is the
|
|
58
|
+
* face of the obstacle the player is approaching.
|
|
59
|
+
*/
|
|
60
|
+
this.obstacleAhead = new SensorHit();
|
|
61
|
+
/**
|
|
62
|
+
* Ledge edge ahead — for ledge grab. Populated when the forward
|
|
63
|
+
* obstacle probe hits and a downward probe just past the
|
|
64
|
+
* obstacle's top finds empty space, indicating a grabbable edge.
|
|
65
|
+
*/
|
|
66
|
+
this.ledgeAhead = new SensorHit();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Clear all sensor slots — call at the start of each tick. */
|
|
70
|
+
clearAll() {
|
|
71
|
+
this.wallLeft.clear();
|
|
72
|
+
this.wallRight.clear();
|
|
73
|
+
this.wallFront.clear();
|
|
74
|
+
this.obstacleAhead.clear();
|
|
75
|
+
this.ledgeAhead.clear();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Populates the {@link FirstPersonSensors} struct on each controller
|
|
3
|
+
* entity, once per fixed step. Designed to run BEFORE the main
|
|
4
|
+
* {@link FirstPersonPlayerControllerSystem} `fixedUpdate` so abilities
|
|
5
|
+
* see fresh sensor data on the same tick.
|
|
6
|
+
*
|
|
7
|
+
* Raycasts go through {@link PhysicsSystem.raycast} — BVH-backed,
|
|
8
|
+
* static + dynamic broadphase. The player's own body is excluded via a
|
|
9
|
+
* per-call filter so downward probes don't collide with the player's
|
|
10
|
+
* own capsule.
|
|
11
|
+
*
|
|
12
|
+
* BVH raycasts are cheap (~1000/frame at 60Hz is comfortable), so this
|
|
13
|
+
* system doesn't aggressively optimize. NPC controllers that don't
|
|
14
|
+
* need sensors can simply not have this system attached.
|
|
15
|
+
*
|
|
16
|
+
* Sensor data lives at `runtime.sensors` on the
|
|
17
|
+
* {@link FirstPersonPlayerControllerSystem}'s per-entity runtime.
|
|
18
|
+
*
|
|
19
|
+
* @author Alex Goldring
|
|
20
|
+
* @copyright Company Named Limited (c) 2026
|
|
21
|
+
*/
|
|
22
|
+
export class FirstPersonSensorsSystem extends System<any, any, any, any, any> {
|
|
23
|
+
constructor();
|
|
24
|
+
dependencies: (typeof Transform | typeof FirstPersonPlayerController)[];
|
|
25
|
+
/**
|
|
26
|
+
* Reference to the controller system — needed to look up each
|
|
27
|
+
* entity's per-controller runtime (which owns the sensors slot).
|
|
28
|
+
* Auto-acquired in startup; can be overridden by the caller.
|
|
29
|
+
* @type {FirstPersonPlayerControllerSystem|null}
|
|
30
|
+
*/
|
|
31
|
+
controllerSystem: FirstPersonPlayerControllerSystem | null;
|
|
32
|
+
/**
|
|
33
|
+
* Physics system used as the spatial-query backend. Auto-acquired
|
|
34
|
+
* in startup; can be overridden. Required — sensors are unusable
|
|
35
|
+
* without it.
|
|
36
|
+
* @type {PhysicsSystem|null}
|
|
37
|
+
*/
|
|
38
|
+
physicsSystem: PhysicsSystem | null;
|
|
39
|
+
/**
|
|
40
|
+
* Pre-allocated raycast query primitive. Refilled in place per
|
|
41
|
+
* {@link _probeRay} call so the system doesn't allocate a new
|
|
42
|
+
* `Ray3` every probe.
|
|
43
|
+
* @private
|
|
44
|
+
* @type {Ray3}
|
|
45
|
+
*/
|
|
46
|
+
private _probe_ray;
|
|
47
|
+
/**
|
|
48
|
+
* Pre-allocated raycast result. Refilled in place per probe;
|
|
49
|
+
* gameplay-visible sensor fields are copied out before the next
|
|
50
|
+
* probe overwrites it.
|
|
51
|
+
* @private
|
|
52
|
+
* @type {PhysicsSurfacePoint}
|
|
53
|
+
*/
|
|
54
|
+
private _probe_hit;
|
|
55
|
+
startup(entityManager: any): Promise<void>;
|
|
56
|
+
fixedUpdate(dt: any): void;
|
|
57
|
+
/**
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
private _populateForEntity;
|
|
61
|
+
/**
|
|
62
|
+
* Raycast through {@link PhysicsSystem.raycast}, populating the slot
|
|
63
|
+
* if anything is hit. Direction is assumed unit (the controller's
|
|
64
|
+
* callers pass body-local unit axes).
|
|
65
|
+
*
|
|
66
|
+
* The raycast now writes the AABB face normal into `_probe_hit.normal`,
|
|
67
|
+
* which is exact for AABB-shaped colliders (the common case in our gym)
|
|
68
|
+
* and a stable approximation elsewhere. Future narrowphase refinement
|
|
69
|
+
* will replace this with the true shape normal at the same call site.
|
|
70
|
+
*
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
73
|
+
private _probeRay;
|
|
74
|
+
}
|
|
75
|
+
import { System } from "../../../ecs/System.js";
|
|
76
|
+
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
77
|
+
import { FirstPersonPlayerController } from "../FirstPersonPlayerController.js";
|
|
78
|
+
import { FirstPersonPlayerControllerSystem } from "../FirstPersonPlayerControllerSystem.js";
|
|
79
|
+
import { PhysicsSystem } from "../../../physics/ecs/PhysicsSystem.js";
|
|
80
|
+
//# sourceMappingURL=FirstPersonSensorsSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FirstPersonSensorsSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IACI,cAsCC;IAnCG,wEAA4D;IAE5D;;;;;OAKG;IACH,kBAFU,iCAAiC,GAAC,IAAI,CAEpB;IAE5B;;;;;OAKG;IACH,eAFU,aAAa,GAAC,IAAI,CAEH;IAEzB;;;;;;OAMG;IACH,mBAA4B;IAE5B;;;;;;OAMG;IACH,mBAA2C;IAG/C,2CAaC;IAED,2BAIC;IAED;;OAEG;IACH,2BAoEC;IAED;;;;;;;;;;;OAWG;IACH,kBAiBC;CACJ;uBA/LsB,wBAAwB;0BACrB,qCAAqC;4CACnB,mCAAmC;kDAC7B,yCAAyC;8BAL7D,uCAAuC"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { Ray3 } from "../../../../core/geom/3d/ray/Ray3.js";
|
|
3
|
+
import { PhysicsSystem } from "../../../physics/ecs/PhysicsSystem.js";
|
|
4
|
+
import { PhysicsSurfacePoint } from "../../../physics/queries/PhysicsSurfacePoint.js";
|
|
5
|
+
import { System } from "../../../ecs/System.js";
|
|
6
|
+
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
7
|
+
import { FirstPersonPlayerController } from "../FirstPersonPlayerController.js";
|
|
8
|
+
import { FirstPersonPlayerControllerSystem } from "../FirstPersonPlayerControllerSystem.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Populates the {@link FirstPersonSensors} struct on each controller
|
|
12
|
+
* entity, once per fixed step. Designed to run BEFORE the main
|
|
13
|
+
* {@link FirstPersonPlayerControllerSystem} `fixedUpdate` so abilities
|
|
14
|
+
* see fresh sensor data on the same tick.
|
|
15
|
+
*
|
|
16
|
+
* Raycasts go through {@link PhysicsSystem.raycast} — BVH-backed,
|
|
17
|
+
* static + dynamic broadphase. The player's own body is excluded via a
|
|
18
|
+
* per-call filter so downward probes don't collide with the player's
|
|
19
|
+
* own capsule.
|
|
20
|
+
*
|
|
21
|
+
* BVH raycasts are cheap (~1000/frame at 60Hz is comfortable), so this
|
|
22
|
+
* system doesn't aggressively optimize. NPC controllers that don't
|
|
23
|
+
* need sensors can simply not have this system attached.
|
|
24
|
+
*
|
|
25
|
+
* Sensor data lives at `runtime.sensors` on the
|
|
26
|
+
* {@link FirstPersonPlayerControllerSystem}'s per-entity runtime.
|
|
27
|
+
*
|
|
28
|
+
* @author Alex Goldring
|
|
29
|
+
* @copyright Company Named Limited (c) 2026
|
|
30
|
+
*/
|
|
31
|
+
export class FirstPersonSensorsSystem extends System {
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
|
|
35
|
+
this.dependencies = [FirstPersonPlayerController, Transform];
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Reference to the controller system — needed to look up each
|
|
39
|
+
* entity's per-controller runtime (which owns the sensors slot).
|
|
40
|
+
* Auto-acquired in startup; can be overridden by the caller.
|
|
41
|
+
* @type {FirstPersonPlayerControllerSystem|null}
|
|
42
|
+
*/
|
|
43
|
+
this.controllerSystem = null;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Physics system used as the spatial-query backend. Auto-acquired
|
|
47
|
+
* in startup; can be overridden. Required — sensors are unusable
|
|
48
|
+
* without it.
|
|
49
|
+
* @type {PhysicsSystem|null}
|
|
50
|
+
*/
|
|
51
|
+
this.physicsSystem = null;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Pre-allocated raycast query primitive. Refilled in place per
|
|
55
|
+
* {@link _probeRay} call so the system doesn't allocate a new
|
|
56
|
+
* `Ray3` every probe.
|
|
57
|
+
* @private
|
|
58
|
+
* @type {Ray3}
|
|
59
|
+
*/
|
|
60
|
+
this._probe_ray = new Ray3();
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Pre-allocated raycast result. Refilled in place per probe;
|
|
64
|
+
* gameplay-visible sensor fields are copied out before the next
|
|
65
|
+
* probe overwrites it.
|
|
66
|
+
* @private
|
|
67
|
+
* @type {PhysicsSurfacePoint}
|
|
68
|
+
*/
|
|
69
|
+
this._probe_hit = new PhysicsSurfacePoint();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async startup(entityManager) {
|
|
73
|
+
this.entityManager = entityManager;
|
|
74
|
+
|
|
75
|
+
// Auto-acquire collaborators if they're already in the world.
|
|
76
|
+
// Caller can still override either field before fixedUpdate runs.
|
|
77
|
+
if (this.controllerSystem === null) {
|
|
78
|
+
const cs = entityManager.getSystem(FirstPersonPlayerControllerSystem);
|
|
79
|
+
if (cs !== null) this.controllerSystem = cs;
|
|
80
|
+
}
|
|
81
|
+
if (this.physicsSystem === null) {
|
|
82
|
+
const ps = entityManager.getSystem(PhysicsSystem);
|
|
83
|
+
if (ps !== null) this.physicsSystem = ps;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
fixedUpdate(dt) {
|
|
88
|
+
const ecd = this.entityManager.dataset;
|
|
89
|
+
if (ecd === null) return;
|
|
90
|
+
ecd.traverseComponents(FirstPersonPlayerController, this._populateForEntity, this);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
96
|
+
_populateForEntity(controller, entity) {
|
|
97
|
+
// Sensors live on the per-entity runtime owned by the
|
|
98
|
+
// controller's own system. Look it up by entity — no leakage
|
|
99
|
+
// through the controller component itself.
|
|
100
|
+
if (this.controllerSystem === null) return; // not wired up
|
|
101
|
+
const runtime = this.controllerSystem.getRuntime(entity);
|
|
102
|
+
if (runtime === undefined) return;
|
|
103
|
+
const sensors = runtime.sensors;
|
|
104
|
+
if (sensors === undefined || sensors === null) return;
|
|
105
|
+
|
|
106
|
+
// Sensors are useless without physics. Assert at the first
|
|
107
|
+
// populate; the misconfiguration would otherwise show up as
|
|
108
|
+
// mysteriously inert abilities.
|
|
109
|
+
assert.notEqual(this.physicsSystem, null,
|
|
110
|
+
"FirstPersonSensorsSystem requires a PhysicsSystem to be in the world. "
|
|
111
|
+
+ "Add it before this system, or set `sensorsSystem.physicsSystem` "
|
|
112
|
+
+ "explicitly.");
|
|
113
|
+
|
|
114
|
+
const ecd = this.entityManager.dataset;
|
|
115
|
+
const transform = ecd.getComponent(entity, Transform);
|
|
116
|
+
if (transform === undefined) return;
|
|
117
|
+
|
|
118
|
+
sensors.clearAll();
|
|
119
|
+
|
|
120
|
+
// Probe origin: at chest height (approx body height × 0.65).
|
|
121
|
+
const cfg = controller.config;
|
|
122
|
+
const chestY = cfg.body.height * 0.65;
|
|
123
|
+
const ox = transform.position.x;
|
|
124
|
+
const oy = transform.position.y + chestY;
|
|
125
|
+
const oz = transform.position.z;
|
|
126
|
+
|
|
127
|
+
// Body-local forward + right (engine-local axes — see DESIGN.md
|
|
128
|
+
// §5.3 for the conventions). bodyYaw lives on the runtime.
|
|
129
|
+
const yaw = runtime.bodyYaw;
|
|
130
|
+
const fx = Math.sin(yaw);
|
|
131
|
+
const fz = Math.cos(yaw);
|
|
132
|
+
const rx = Math.cos(yaw);
|
|
133
|
+
const rz = -Math.sin(yaw);
|
|
134
|
+
|
|
135
|
+
const wallProbeDist = cfg.body.radius * 2 + 0.05; // just past the capsule
|
|
136
|
+
const obstacleProbeDist = 1.2; // ~one stride
|
|
137
|
+
|
|
138
|
+
// Wall left: probe along -right.
|
|
139
|
+
this._probeRay(sensors.wallLeft, ox, oy, oz, -rx, 0, -rz, wallProbeDist, entity);
|
|
140
|
+
// Wall right: probe along +right.
|
|
141
|
+
this._probeRay(sensors.wallRight, ox, oy, oz, rx, 0, rz, wallProbeDist, entity);
|
|
142
|
+
// Wall front: probe along +forward.
|
|
143
|
+
this._probeRay(sensors.wallFront, ox, oy, oz, fx, 0, fz, wallProbeDist, entity);
|
|
144
|
+
// Obstacle ahead: same direction as wallFront but longer reach.
|
|
145
|
+
// Used by mantle/vault; the consumer compares the hit altitude to
|
|
146
|
+
// the body height to decide vault vs. mantle vs. neither.
|
|
147
|
+
this._probeRay(sensors.obstacleAhead, ox, oy, oz, fx, 0, fz, obstacleProbeDist, entity);
|
|
148
|
+
|
|
149
|
+
// Ledge ahead — only meaningful if obstacleAhead hit something
|
|
150
|
+
// around chest height: probe down from just past the top of the
|
|
151
|
+
// obstacle, look for ground.
|
|
152
|
+
if (sensors.obstacleAhead.hit) {
|
|
153
|
+
const topY = transform.position.y + cfg.body.height + 0.1;
|
|
154
|
+
const px = sensors.obstacleAhead.point.x + fx * 0.3;
|
|
155
|
+
const pz = sensors.obstacleAhead.point.z + fz * 0.3;
|
|
156
|
+
this._probeRay(
|
|
157
|
+
sensors.ledgeAhead,
|
|
158
|
+
px, topY, pz,
|
|
159
|
+
0, -1, 0,
|
|
160
|
+
cfg.body.height * 0.5,
|
|
161
|
+
entity,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Raycast through {@link PhysicsSystem.raycast}, populating the slot
|
|
168
|
+
* if anything is hit. Direction is assumed unit (the controller's
|
|
169
|
+
* callers pass body-local unit axes).
|
|
170
|
+
*
|
|
171
|
+
* The raycast now writes the AABB face normal into `_probe_hit.normal`,
|
|
172
|
+
* which is exact for AABB-shaped colliders (the common case in our gym)
|
|
173
|
+
* and a stable approximation elsewhere. Future narrowphase refinement
|
|
174
|
+
* will replace this with the true shape normal at the same call site.
|
|
175
|
+
*
|
|
176
|
+
* @private
|
|
177
|
+
*/
|
|
178
|
+
_probeRay(slot, ox, oy, oz, dx, dy, dz, maxDist, excludeEntity) {
|
|
179
|
+
// Exclude the player's own body from the result — downward
|
|
180
|
+
// probes from chest start inside the capsule, would otherwise
|
|
181
|
+
// hit the capsule's bottom hemisphere.
|
|
182
|
+
const ray = this._probe_ray;
|
|
183
|
+
ray.setOrigin(ox, oy, oz);
|
|
184
|
+
ray.setDirection(dx, dy, dz);
|
|
185
|
+
ray.tMax = maxDist;
|
|
186
|
+
const filter = (e) => e !== excludeEntity;
|
|
187
|
+
const out = this._probe_hit;
|
|
188
|
+
if (!this.physicsSystem.raycast(ray, out, filter)) return;
|
|
189
|
+
|
|
190
|
+
slot.hit = true;
|
|
191
|
+
slot.distance = out.t;
|
|
192
|
+
slot.point.set(out.position.x, out.position.y, out.position.z);
|
|
193
|
+
slot.normal.set(out.normal.x, out.normal.y, out.normal.z);
|
|
194
|
+
slot.surfaceTag = null; // future: surface-tag lookup
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec-side helper: build the RigidBody + Collider pair the controller's
|
|
3
|
+
* link() expects. Each test's makeWorld() can call this after
|
|
4
|
+
* constructing the controller + transform, adding both components to
|
|
5
|
+
* the entity builder before `.build(ecd)`.
|
|
6
|
+
*
|
|
7
|
+
* Capsule dimensions are loose — the prototype sizes them from
|
|
8
|
+
* `cfg.body` but tests don't exercise the actual collision shape; what
|
|
9
|
+
* matters for the controller's assert is that a RigidBody of the right
|
|
10
|
+
* kind is present.
|
|
11
|
+
*
|
|
12
|
+
* @returns {{ rigidBody: RigidBody, collider: Collider }}
|
|
13
|
+
*/
|
|
14
|
+
export function buildTestPlayerBody(): {
|
|
15
|
+
rigidBody: RigidBody;
|
|
16
|
+
collider: Collider;
|
|
17
|
+
};
|
|
18
|
+
import { RigidBody } from "../../../physics/ecs/RigidBody.js";
|
|
19
|
+
import { Collider } from "../../../physics/ecs/Collider.js";
|
|
20
|
+
//# sourceMappingURL=buildTestPlayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildTestPlayer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/control/first-person/test/buildTestPlayer.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AACH;eAF0B,SAAS;cAAY,QAAQ;EAWtD;0BAxByB,mCAAmC;yBADpC,kCAAkC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CapsuleShape3D } from "../../../../core/geom/3d/shape/CapsuleShape3D.js";
|
|
2
|
+
import { BodyKind } from "../../../physics/ecs/BodyKind.js";
|
|
3
|
+
import { Collider } from "../../../physics/ecs/Collider.js";
|
|
4
|
+
import { RigidBody } from "../../../physics/ecs/RigidBody.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Spec-side helper: build the RigidBody + Collider pair the controller's
|
|
8
|
+
* link() expects. Each test's makeWorld() can call this after
|
|
9
|
+
* constructing the controller + transform, adding both components to
|
|
10
|
+
* the entity builder before `.build(ecd)`.
|
|
11
|
+
*
|
|
12
|
+
* Capsule dimensions are loose — the prototype sizes them from
|
|
13
|
+
* `cfg.body` but tests don't exercise the actual collision shape; what
|
|
14
|
+
* matters for the controller's assert is that a RigidBody of the right
|
|
15
|
+
* kind is present.
|
|
16
|
+
*
|
|
17
|
+
* @returns {{ rigidBody: RigidBody, collider: Collider }}
|
|
18
|
+
*/
|
|
19
|
+
export function buildTestPlayerBody() {
|
|
20
|
+
const rigidBody = new RigidBody();
|
|
21
|
+
rigidBody.kind = BodyKind.KinematicPosition;
|
|
22
|
+
rigidBody.mass = 1;
|
|
23
|
+
|
|
24
|
+
const collider = new Collider();
|
|
25
|
+
collider.shape = CapsuleShape3D.from(0.34, 1.12);
|
|
26
|
+
|
|
27
|
+
return { rigidBody, collider };
|
|
28
|
+
}
|
|
@@ -157,9 +157,9 @@ export class EntityManager {
|
|
|
157
157
|
getComponentClassByName<T_2>(className: string): null | Class<T_2>;
|
|
158
158
|
/**
|
|
159
159
|
* Advance simulation forward by a specified amount of time
|
|
160
|
-
* @param {number}
|
|
160
|
+
* @param {number} time_delta_seconds in seconds
|
|
161
161
|
*/
|
|
162
|
-
simulate(
|
|
162
|
+
simulate(time_delta_seconds: number): void;
|
|
163
163
|
/**
|
|
164
164
|
* If the {@link EntityManager} is already started, the system will be started automatically before being added
|
|
165
165
|
* @param {System} system
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityManager.js"],"names":[],"mappings":"iCAgBU,MAAM;;;;;;;;;AAiBhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IAEI;;;;OAIG;IACH,kBAFU,iCAAQ,CAEL;IAEb;;;;;;OAMG;IACH,uCAA2B;IAE3B;;;;;OAKG;IACH,iCAA4B;IAE5B;;OAEG;IACH;;;QAGI;;WAEG;qBADO,uCAAc;;MAI1B;IAEF;;;OAGG;IACH,OAFU,kBAAkB,CAEO;IAEnC;;;;;;OAMG;IACH,gDAA2C;IAE3C;;;;;;;;;OASG;IACH,qBAFU,MAAM,CAEqB;IAErC;;;;;OAKG;IACH,wCAFU,MAAM,CAE4B;IAE5C;;;;OAIG;IACH,SAFU,sBAAsB,CAEjB;IAEf;;;;;OAKG;IACH,uCAAsC;IAEtC;;;OAGG;IACH,6BAmFC;IAED;;;OAGG;IACH,uBAFa,OAAO,CAuBnB;IAED;;;;;OAKG;IACH,uBAJW,sBAAsB,QA4ChC;IAGD;;;OAGG;IACH,sBA2BC;IAED;;;;OAIG;IACH,qCAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,6CAgBC;IAED;;;;;OAKG;IACH,wCAHW,MAAM,GACJ,IAAI,aAAS,CAiBzB;IAGD;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"EntityManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityManager.js"],"names":[],"mappings":"iCAgBU,MAAM;;;;;;;;;AAiBhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IAEI;;;;OAIG;IACH,kBAFU,iCAAQ,CAEL;IAEb;;;;;;OAMG;IACH,uCAA2B;IAE3B;;;;;OAKG;IACH,iCAA4B;IAE5B;;OAEG;IACH;;;QAGI;;WAEG;qBADO,uCAAc;;MAI1B;IAEF;;;OAGG;IACH,OAFU,kBAAkB,CAEO;IAEnC;;;;;;OAMG;IACH,gDAA2C;IAE3C;;;;;;;;;OASG;IACH,qBAFU,MAAM,CAEqB;IAErC;;;;;OAKG;IACH,wCAFU,MAAM,CAE4B;IAE5C;;;;OAIG;IACH,SAFU,sBAAsB,CAEjB;IAEf;;;;;OAKG;IACH,uCAAsC;IAEtC;;;OAGG;IACH,6BAmFC;IAED;;;OAGG;IACH,uBAFa,OAAO,CAuBnB;IAED;;;;;OAKG;IACH,uBAJW,sBAAsB,QA4ChC;IAGD;;;OAGG;IACH,sBA2BC;IAED;;;;OAIG;IACH,qCAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,6CAgBC;IAED;;;;;OAKG;IACH,wCAHW,MAAM,GACJ,IAAI,aAAS,CAiBzB;IAGD;;;OAGG;IACH,6BAFW,MAAM,QAyEhB;IAED;;;;;OAKG;IACH,iEA6DC;IAED;;;;OAIG;IACH,uDAFa,QAAQ,OAAO,CAAC,CA2C5B;IAED;;;;;OAKG;IACH,mBAmCC;IAED;;;;;OAKG;IACH,oBAqFC;IAED;;;;;OAKG;IACH,kEAyEC;IAED;;;;OAIG;IACH,mCAFa,wCAAgB,CA0B5B;IAED;;;;OAIG;IACH,8DAFa,wCAAgB,CA0B5B;IAED;;;;;OAKG;IACH,mEAoFC;IAGL;;OAEG;IACH,yBAjsBe,sBAAsB,UAisBA;IACrC;;OAEG;IACH,0BAAqC;CATpC;uBA/7BmC,aAAa;mBAR9B,oCAAoC;uCAMhB,6BAA6B"}
|
|
@@ -405,13 +405,18 @@ export class EntityManager {
|
|
|
405
405
|
|
|
406
406
|
/**
|
|
407
407
|
* Advance simulation forward by a specified amount of time
|
|
408
|
-
* @param {number}
|
|
408
|
+
* @param {number} time_delta_seconds in seconds
|
|
409
409
|
*/
|
|
410
|
-
simulate(
|
|
411
|
-
assert.isNumber(
|
|
412
|
-
assert.notNaN(
|
|
413
|
-
assert.greaterThanOrEqual(
|
|
414
|
-
assert.isFinite(
|
|
410
|
+
simulate(time_delta_seconds) {
|
|
411
|
+
assert.isNumber(time_delta_seconds, 'timeDelta');
|
|
412
|
+
assert.notNaN(time_delta_seconds, 'timeDelta');
|
|
413
|
+
assert.greaterThanOrEqual(time_delta_seconds, 0, 'time_delta_seconds must be >= 0');
|
|
414
|
+
assert.isFinite(time_delta_seconds, 'timeDelta');
|
|
415
|
+
|
|
416
|
+
if (this.dataset === null) {
|
|
417
|
+
// dataset is not attached
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
415
420
|
|
|
416
421
|
if (this.__execution_order_needs_update) {
|
|
417
422
|
this.updateExecutionOrder();
|
|
@@ -437,7 +442,7 @@ export class EntityManager {
|
|
|
437
442
|
|
|
438
443
|
// Perform fixed-step update
|
|
439
444
|
if (system.fixedUpdate !== noop) {
|
|
440
|
-
let accumulated_time = accumulatedTime.get(system) +
|
|
445
|
+
let accumulated_time = accumulatedTime.get(system) + time_delta_seconds;
|
|
441
446
|
|
|
442
447
|
const t0 = performance.now();
|
|
443
448
|
|
|
@@ -465,7 +470,7 @@ export class EntityManager {
|
|
|
465
470
|
if (system.update !== noop) {
|
|
466
471
|
|
|
467
472
|
try {
|
|
468
|
-
system.update(
|
|
473
|
+
system.update(time_delta_seconds);
|
|
469
474
|
} catch (e) {
|
|
470
475
|
console.error(`Failed during update of system '${computeSystemName(system)}': `, e);
|
|
471
476
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/System.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH;IAEI;;;;;OAKG;IACH,uCAAqB;IAErB;;;;OAIG;IACH,oBAA+C;IAE/C;;;;;;;OAOG;IACH,6BAAkB;IAElB;;;;;;;;;;OAUG;IACH,0BAFU,6BAA6B,CAElB;IAGrB;;OAEG;IACH,mCAcC;IAED;;;;;OAKG;IACH,oCAFY,MAAM,CA8BjB;IAED;;;;;;OAMG;IACH,uCAHa,QAAQ,IAAI,CAAC,CAKzB;IAED;;;;;;;OAOG;IACH,wCAHa,QAAQ,IAAI,CAAC,CAKzB;IAGD;;;;OAIG;IACH,wCAEC;IAED;;;;OAIG;IACH,0CAEC;IAED;;;;;;;;;;OAUG;IACH,6DAEC;IAED;;;;;;;;;;OAUG;IACH,6DAEC;IAIL;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/System.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH;IAEI;;;;;OAKG;IACH,uCAAqB;IAErB;;;;OAIG;IACH,oBAA+C;IAE/C;;;;;;;OAOG;IACH,6BAAkB;IAElB;;;;;;;;;;OAUG;IACH,0BAFU,6BAA6B,CAElB;IAGrB;;OAEG;IACH,mCAcC;IAED;;;;;OAKG;IACH,oCAFY,MAAM,CA8BjB;IAED;;;;;;OAMG;IACH,uCAHa,QAAQ,IAAI,CAAC,CAKzB;IAED;;;;;;;OAOG;IACH,wCAHa,QAAQ,IAAI,CAAC,CAKzB;IAGD;;;;OAIG;IACH,wCAEC;IAED;;;;OAIG;IACH,0CAEC;IAED;;;;;;;;;;OAUG;IACH,6DAEC;IAED;;;;;;;;;;OAUG;IACH,6DAEC;IAIL;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,2CAFsC,MAAM,CAEhB;IAG5B;;;;;;OAMG;IACH,sCAFsC,MAAM,CAErB;CAvBtB;0BA2BS,MAAM"}
|
package/src/engine/ecs/System.js
CHANGED
|
@@ -213,7 +213,7 @@ System.prototype.isSystem = true;
|
|
|
213
213
|
/**
|
|
214
214
|
* Fixed update function, every step happens with the same exact time increment
|
|
215
215
|
* useful for systems that must have a fixed time step to be predictable and stable, such as physics
|
|
216
|
-
* @
|
|
216
|
+
* @type {function(time_delta_seconds:number)} time delta will always be the same value, controlled via {@link EntityManager.fixedUpdateStepSize}
|
|
217
217
|
*/
|
|
218
218
|
System.prototype.fixedUpdate = noop; // by assigning NO-OP we enable a simple check, whether running the update would be useful
|
|
219
219
|
|
|
@@ -223,7 +223,7 @@ System.prototype.fixedUpdate = noop; // by assigning NO-OP we enable a simple ch
|
|
|
223
223
|
* Note that this time step can vary depending on system conditions and hardware we are running on.
|
|
224
224
|
* It is generally safe to assume that this update will happen once per frame, but it is not guaranteed.
|
|
225
225
|
* Also, note that when the application window/tab is suspended, the next update step can have a very large value.
|
|
226
|
-
* @
|
|
226
|
+
* @type {function(time_delta_seconds:number)}
|
|
227
227
|
*/
|
|
228
228
|
System.prototype.update = noop; // by assigning NO-OP we enable a simple check, whether running the update would be useful
|
|
229
229
|
|
|
@@ -19,7 +19,6 @@ import ViewportPositionSystem from "../../ecs/gui/position/ViewportPositionSyste
|
|
|
19
19
|
import { InverseKinematicsSystem } from "../../ecs/ik/InverseKinematicsSystem.js";
|
|
20
20
|
import RenderSystem from "../../ecs/renderable/RenderSystem.js";
|
|
21
21
|
import AnimationSystem from "../../ecs/systems/AnimationSystem.js";
|
|
22
|
-
import MotionSystem from "../../ecs/systems/MotionSystem.js";
|
|
23
22
|
import ScriptSystem from "../../ecs/systems/ScriptSystem.js";
|
|
24
23
|
import TimerSystem from "../../ecs/systems/TimerSystem.js";
|
|
25
24
|
import ClingToTerrainSystem from "../../ecs/terrain/ecs/cling/ClingToTerrainSystem.js";
|
|
@@ -74,7 +73,6 @@ function makeConfig(engine) {
|
|
|
74
73
|
new ScriptSystem(),
|
|
75
74
|
new FacingDirectionSystem(),
|
|
76
75
|
new PathFollowingSystem(),
|
|
77
|
-
new MotionSystem(),
|
|
78
76
|
new SoundEmitterSystem(assetManager, sound.destination, sound.context),
|
|
79
77
|
new SoundControllerSystem(),
|
|
80
78
|
new SoundListenerSystem(sound.context),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Light.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/light/Light.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Light.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/light/Light.js"],"names":[],"mappings":"AAUA;IAuEI;;;;OAIG;IACH,yBAFa,KAAK,CAQjB;IA5EG;;;OAGG;IACH,wBAA4D;IAE5D;;;OAGG;IACH,OAFU,KAAK,CAEgB;IAE/B;;;OAGG;IACH,WAFU,OAAO,CAEc;IAE/B;;;OAGG;IACH,OAFU,OAAO,CAEoB;IAErC;;;OAGG;IACH,UAFU,OAAO,CAEe;IAEhC;;;OAGG;IACH,UAFU,OAAO,CAE4B;IAE7C;;;;;OAKG;IACH,mBAFU,OAAO,CAEgD;IAEjE;;;OAGG;IACH,YAFU,eAAe,CAEmB;IAE5C;;;;OAIG;IACH,sBAAyB;IAEzB;;;;OAIG;IACH,mBAAsB;IAgB1B,0BA6DC;IAED;;;;;MA+BC;CACJ;;;;;yBA1LwB,wCAAwC;sBAH3C,iCAAiC;oBACnC,kCAAkC;4BAC1B,2CAA2C;0BAE7C,gBAAgB"}
|
|
@@ -6,6 +6,7 @@ import { LightType } from "./LightType.js";
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
const DEFAULT_DISTANCE = 1;
|
|
9
|
+
const DEFAULT_MAX_SHADOW_DISTANCE = Infinity;
|
|
9
10
|
|
|
10
11
|
export class Light {
|
|
11
12
|
/**
|
|
@@ -49,6 +50,14 @@ export class Light {
|
|
|
49
50
|
*/
|
|
50
51
|
this.distance = new Vector1(DEFAULT_DISTANCE);
|
|
51
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Applicable for DIRECTION light. Caps the world-space depth of the view
|
|
55
|
+
* frustum the shadow map is fit against — smaller values trade visible
|
|
56
|
+
* shadow distance for sharpness. `Infinity` fits the entire camera frustum.
|
|
57
|
+
* @type {Vector1}
|
|
58
|
+
*/
|
|
59
|
+
this.maxShadowDistance = new Vector1(DEFAULT_MAX_SHADOW_DISTANCE);
|
|
60
|
+
|
|
52
61
|
/**
|
|
53
62
|
*
|
|
54
63
|
* @type {ObservedBoolean}
|
|
@@ -135,6 +144,14 @@ export class Light {
|
|
|
135
144
|
this.distance.set(DEFAULT_DISTANCE);
|
|
136
145
|
}
|
|
137
146
|
}
|
|
147
|
+
|
|
148
|
+
if (actual_type === LightType.DIRECTION) {
|
|
149
|
+
if (json.maxShadowDistance !== undefined && json.maxShadowDistance !== null) {
|
|
150
|
+
this.maxShadowDistance.fromJSON(json.maxShadowDistance);
|
|
151
|
+
} else {
|
|
152
|
+
this.maxShadowDistance.set(DEFAULT_MAX_SHADOW_DISTANCE);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
138
155
|
this.__threeObject = null;
|
|
139
156
|
}
|
|
140
157
|
|
|
@@ -157,6 +174,16 @@ export class Light {
|
|
|
157
174
|
result.distance = this.distance.toJSON();
|
|
158
175
|
}
|
|
159
176
|
|
|
177
|
+
if (actual_type === LightType.DIRECTION) {
|
|
178
|
+
// JSON.stringify turns Infinity into null and the rehydrated value
|
|
179
|
+
// would fail Vector1.set's number check; default is Infinity so
|
|
180
|
+
// missing-on-disk is the same as default.
|
|
181
|
+
const v = this.maxShadowDistance.getValue();
|
|
182
|
+
if (Number.isFinite(v)) {
|
|
183
|
+
result.maxShadowDistance = this.maxShadowDistance.toJSON();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
160
187
|
|
|
161
188
|
return result;
|
|
162
189
|
}
|
|
@@ -216,7 +216,7 @@ class LightSystem extends AbstractContextSystem {
|
|
|
216
216
|
three_update_shadow_camera_extents(
|
|
217
217
|
this.__camera_object,
|
|
218
218
|
l,
|
|
219
|
-
|
|
219
|
+
light.maxShadowDistance.getValue(),
|
|
220
220
|
this.__graphics.layers
|
|
221
221
|
);
|
|
222
222
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathDisplaySystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/path/PathDisplaySystem.js"],"names":[],"mappings":"AAoPA;IACI;;;OAGG;IACH,4BAwCC;IAnCG,mDAGC;IAED,2KAIC;IAED;;;OAGG;IACH,eAAoB;IAEpB;;;OAGG;IACH,iCAAkB;IAElB;;;;OAIG;IACH,wBAAkC;IAElC;;;OAGG;IACH,YAFU,MAAM,CAEc;IAGlC;;;;OAIG;IACH,8BAFW,MAAM,QAQhB;IAED;;;;OAIG;IACH,6BAFW,MAAM,QAIhB;IAED,2CAGC;IAED,4CAGC;IAED,8BA+BC;CACJ;sCA7VqC,8CAA8C;
|
|
1
|
+
{"version":3,"file":"PathDisplaySystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/path/PathDisplaySystem.js"],"names":[],"mappings":"AAoPA;IACI;;;OAGG;IACH,4BAwCC;IAnCG,mDAGC;IAED,2KAIC;IAED;;;OAGG;IACH,eAAoB;IAEpB;;;OAGG;IACH,iCAAkB;IAElB;;;;OAIG;IACH,wBAAkC;IAElC;;;OAGG;IACH,YAFU,MAAM,CAEc;IAGlC;;;;OAIG;IACH,8BAFW,MAAM,QAQhB;IAED;;;;OAIG;IACH,6BAFW,MAAM,QAIhB;IAED,2CAGC;IAED,4CAGC;IAED,8BA+BC;CACJ;sCA7VqC,8CAA8C;4BAQxD,kBAAkB;iBAL7B,4CAA4C;0BADnC,qCAAqC;4CAJnB,uDAAuD;6BACtE,qCAAqC;+BAOnC,8BAA8B;8BAD/B,gCAAgC;mBAT3C,0CAA0C"}
|