@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 @@
|
|
|
1
|
+
{"version":3,"file":"LedgeGrab.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/control/first-person/abilities/LedgeGrab.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH;IAMQ,uEAAuE;IACvE,eAAe;IACf,eAAe;IACf,eAAe;IAGnB,kEAkBC;IAED,gDA8BC;IAED,wBAKC;IAED,wFAwEC;CACJ;wBApMuB,cAAc"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { clamp } from "../../../../core/math/clamp.js";
|
|
2
|
+
import { FirstPersonPosture } from "../pose/FirstPersonPosture.js";
|
|
3
|
+
import { Ability } from "./Ability.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Ledge-grab ability — snap to a forward ledge while descending and hang
|
|
7
|
+
* from it until the player chooses (or is forced) to release.
|
|
8
|
+
*
|
|
9
|
+
* Activation:
|
|
10
|
+
* - `sensors.ledgeAhead.hit` (a forward+up obstacle probe found a grab-
|
|
11
|
+
* able edge — typically the same probe mantle uses).
|
|
12
|
+
* - `runtime.velocityY <= 0` — the player is descending or static. We
|
|
13
|
+
* don't auto-catch ledges on the way UP — that would feel like the
|
|
14
|
+
* world is grabbing the player mid-jump.
|
|
15
|
+
* - `state.airborneTime >= minAirborneTime` — leaves a small window
|
|
16
|
+
* after takeoff where ledge-grab can't fire, even if the player is
|
|
17
|
+
* instantly at apex (which would otherwise satisfy `velocityY <= 0`).
|
|
18
|
+
* - Forward intent (`intent.move.y > 0.1`) — the player must be
|
|
19
|
+
* committing into the ledge. Walking backwards off an edge shouldn't
|
|
20
|
+
* auto-catch the lip.
|
|
21
|
+
*
|
|
22
|
+
* Behaviour:
|
|
23
|
+
* - Body position snaps to a "hang from edge" pose: at the ledge edge
|
|
24
|
+
* X/Z (with a small back-offset so the body is pulled against the
|
|
25
|
+
* wall below), and Y offset down by ~bodyHeight so the hands grip
|
|
26
|
+
* the edge with the body suspended below.
|
|
27
|
+
* - Velocity is zeroed each tick — the body is parked.
|
|
28
|
+
* - Exertion rises at `cfg.exertionRiseRate` per second, scaled by
|
|
29
|
+
* mass. Climbing fatigue: hang too long and the next exit is
|
|
30
|
+
* forced (a slip).
|
|
31
|
+
* - Grounded stays false (the player is hanging in air).
|
|
32
|
+
*
|
|
33
|
+
* Exit:
|
|
34
|
+
* - Jump pressed (rising edge) → mantle-up. Release with a small
|
|
35
|
+
* upward velocity so mantle's ledgeAhead probe still hits next
|
|
36
|
+
* tick; mantle (priority 30) then takes over and animates the
|
|
37
|
+
* climb-onto-surface path.
|
|
38
|
+
* - Back-intent (`intent.move.y < -0.1`) → drop. Release with zero
|
|
39
|
+
* velocity; the player falls under base gravity.
|
|
40
|
+
* - Crouch pressed → drop. Same as back-intent.
|
|
41
|
+
* - Exertion saturates (`>= 1`) → slip. Release with zero velocity.
|
|
42
|
+
* - `sensors.ledgeAhead.hit` becomes false → shuffled off the edge.
|
|
43
|
+
* Release with zero velocity.
|
|
44
|
+
*
|
|
45
|
+
* Priority 40 — above mantle (30), below wall-run (50). Mantle CAN'T
|
|
46
|
+
* preempt an active ledge-grab — that's the point of placing ledge
|
|
47
|
+
* higher. Otherwise mantle would fire mid-hang and snap the body away.
|
|
48
|
+
* Wall-run and wall-jump can preempt — but in practice they need lateral
|
|
49
|
+
* walls + speed (wall-run) or a jump press near a side wall (wall-jump),
|
|
50
|
+
* conditions which rarely hold while hanging.
|
|
51
|
+
*
|
|
52
|
+
* @author Alex Goldring
|
|
53
|
+
* @copyright Company Named Limited (c) 2026
|
|
54
|
+
*/
|
|
55
|
+
export class LedgeGrab extends Ability {
|
|
56
|
+
constructor() {
|
|
57
|
+
super();
|
|
58
|
+
this.name = "LedgeGrab";
|
|
59
|
+
this.priority = 40;
|
|
60
|
+
|
|
61
|
+
/** @private World-space ledge edge position captured at onActivate. */
|
|
62
|
+
this._edgeX = 0;
|
|
63
|
+
this._edgeY = 0;
|
|
64
|
+
this._edgeZ = 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
canActivate(controller, runtime, sensors) {
|
|
68
|
+
const cfg = controller.config.ledgeGrab;
|
|
69
|
+
if (!cfg) return false;
|
|
70
|
+
if (sensors === undefined || sensors === null) return false;
|
|
71
|
+
|
|
72
|
+
if (!sensors.ledgeAhead.hit) return false;
|
|
73
|
+
if (runtime.velocityY > 0) return false; // not on the way up
|
|
74
|
+
if (controller.state.grounded) return false;
|
|
75
|
+
if (controller.state.airborneTime < cfg.minAirborneTime) return false;
|
|
76
|
+
if (controller.intent.move.y < 0.1) return false;
|
|
77
|
+
// Crouch or exhausted: don't re-grab. These are the same exit
|
|
78
|
+
// conditions that would IMMEDIATELY release after activation, so
|
|
79
|
+
// gating them here prevents a same-tick re-activation flicker
|
|
80
|
+
// after a crouch-release or slip.
|
|
81
|
+
if (controller.intent.crouch) return false;
|
|
82
|
+
if (controller.state.exertion >= 1.0) return false;
|
|
83
|
+
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
onActivate(controller, runtime) {
|
|
88
|
+
const sensors = runtime.sensors;
|
|
89
|
+
const edge = sensors.ledgeAhead.point;
|
|
90
|
+
|
|
91
|
+
this._edgeX = edge.x;
|
|
92
|
+
this._edgeY = edge.y;
|
|
93
|
+
this._edgeZ = edge.z;
|
|
94
|
+
|
|
95
|
+
// Zero velocity — the body is now parked on the ledge.
|
|
96
|
+
runtime.velocityX = 0;
|
|
97
|
+
runtime.velocityY = 0;
|
|
98
|
+
runtime.velocityZ = 0;
|
|
99
|
+
|
|
100
|
+
// Clear any in-progress jump state — hanging supersedes them.
|
|
101
|
+
runtime.midJump = false;
|
|
102
|
+
runtime.apexFired = false;
|
|
103
|
+
controller.state.isVariableJumpCut = false;
|
|
104
|
+
controller.state.isAscending = false;
|
|
105
|
+
|
|
106
|
+
// The body is hanging — not on the ground.
|
|
107
|
+
controller.state.grounded = false;
|
|
108
|
+
|
|
109
|
+
// Body is suspended by the hands; no striding feet, head near
|
|
110
|
+
// the hands gripping the edge. L2 reads posture to gate gait
|
|
111
|
+
// and set eye height.
|
|
112
|
+
controller.state.posture = FirstPersonPosture.Hang;
|
|
113
|
+
|
|
114
|
+
controller.signals.onLedgeGrab.send1({
|
|
115
|
+
ledgeHeight: this._edgeY - controller.pose.rootPosition.y,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
canInterrupt() {
|
|
120
|
+
// Wall-run / wall-jump can preempt if their conditions
|
|
121
|
+
// somehow hold (unusual mid-hang). Higher-priority abilities
|
|
122
|
+
// shouldn't be blocked.
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
tick(controller, runtime, bodyTransform, dt, _system) {
|
|
127
|
+
const cfg = controller.config.ledgeGrab;
|
|
128
|
+
const sensors = runtime.sensors;
|
|
129
|
+
|
|
130
|
+
// Re-assert posture each tick (defence against any layer
|
|
131
|
+
// resetting it before L2 reads).
|
|
132
|
+
controller.state.posture = FirstPersonPosture.Hang;
|
|
133
|
+
// Body is parked against the wall under the ledge — no lean.
|
|
134
|
+
runtime.leanTargetRad = 0;
|
|
135
|
+
|
|
136
|
+
// -- Exit: lost the ledge (shuffled past the edge, ledge ended).
|
|
137
|
+
if (!sensors.ledgeAhead.hit) {
|
|
138
|
+
controller.signals.onLedgeRelease.send1({ reason: "shuffle-off" });
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// -- Exit: jump rising-edge → mantle-up. Apply small upward
|
|
143
|
+
// velocity so the next tick's mantle.canActivate finds an
|
|
144
|
+
// obstacleAhead + ledgeAhead at the right relative height.
|
|
145
|
+
if (controller.intent.jump && !runtime.prevJumpHeld) {
|
|
146
|
+
runtime.velocityY = runtime.jumpInitialVy * cfg.mantleUpUpFactor;
|
|
147
|
+
runtime.prevJumpHeld = true;
|
|
148
|
+
runtime.midJump = true;
|
|
149
|
+
controller.state.isAscending = true;
|
|
150
|
+
controller.signals.onLedgeRelease.send1({ reason: "mantle-up" });
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// -- Exit: back-intent → drop. Zero velocity (let gravity take over
|
|
155
|
+
// on the next tick).
|
|
156
|
+
if (controller.intent.move.y < -0.1) {
|
|
157
|
+
controller.signals.onLedgeRelease.send1({ reason: "drop" });
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// -- Exit: crouch → drop.
|
|
162
|
+
if (controller.intent.crouch) {
|
|
163
|
+
controller.signals.onLedgeRelease.send1({ reason: "drop" });
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// -- Exit: exertion saturated → slip.
|
|
168
|
+
if (controller.state.exertion >= 1.0) {
|
|
169
|
+
controller.signals.onLedgeRelease.send1({ reason: "slip" });
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// -- Hold: snap to hang position, zero velocity, tick exertion.
|
|
174
|
+
// Pull the body slightly back from the ledge edge along the
|
|
175
|
+
// body's forward direction so it visually grips the lip rather
|
|
176
|
+
// than sitting directly on it.
|
|
177
|
+
const fx = Math.sin(runtime.bodyYaw);
|
|
178
|
+
const fz = Math.cos(runtime.bodyYaw);
|
|
179
|
+
bodyTransform.position.set(
|
|
180
|
+
this._edgeX + fx * cfg.hangOffsetForward,
|
|
181
|
+
this._edgeY + cfg.hangOffsetY,
|
|
182
|
+
this._edgeZ + fz * cfg.hangOffsetForward,
|
|
183
|
+
);
|
|
184
|
+
runtime.velocityX = 0;
|
|
185
|
+
runtime.velocityY = 0;
|
|
186
|
+
runtime.velocityZ = 0;
|
|
187
|
+
controller.state.grounded = false;
|
|
188
|
+
|
|
189
|
+
// Exertion rises while hanging — fatigue. Mass-scaled like the
|
|
190
|
+
// rest of the exertion system.
|
|
191
|
+
controller.state.exertion = clamp(
|
|
192
|
+
controller.state.exertion + cfg.exertionRiseRate * dt
|
|
193
|
+
* runtime.massRatios.exertionRiseScale,
|
|
194
|
+
0, 1,
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mantle ability — auto-triggers when the player walks/runs into a
|
|
3
|
+
* reachable obstacle with forward intent. The body follows a scripted
|
|
4
|
+
* parametric path (horizontal lerp on an ease-in-out, vertical lerp on
|
|
5
|
+
* an ease-out) for {@link cfg.mantle.duration} seconds, landing on top
|
|
6
|
+
* of the surface.
|
|
7
|
+
*
|
|
8
|
+
* Activation requires both `sensors.obstacleAhead.hit` (something in
|
|
9
|
+
* front to climb) AND `sensors.ledgeAhead.hit` (there's a top surface
|
|
10
|
+
* to land on). Heights between `cfg.mantle.minHeight` and `maxHeight`
|
|
11
|
+
* are accepted; below is "just step over", above is "out of reach".
|
|
12
|
+
*
|
|
13
|
+
* The ability is FULLY non-interruptible once committed — `canInterrupt`
|
|
14
|
+
* returns false throughout. This prevents the body from teleporting
|
|
15
|
+
* mid-mantle if a higher-priority ability fires; the trade-off is the
|
|
16
|
+
* player has limited control during the short window. Player input
|
|
17
|
+
* for THIS frame is effectively suspended.
|
|
18
|
+
*
|
|
19
|
+
* Priority 30: above Slide (10) so an obstacle vault-into preempts a
|
|
20
|
+
* slide; below Wall-run / Wall-jump so those high-air abilities still
|
|
21
|
+
* win if their conditions are simultaneously met (which would be
|
|
22
|
+
* unusual — typically you mantle from the ground).
|
|
23
|
+
*
|
|
24
|
+
* @author Alex Goldring
|
|
25
|
+
* @copyright Company Named Limited (c) 2026
|
|
26
|
+
*/
|
|
27
|
+
export class Mantle extends Ability {
|
|
28
|
+
/** @private Elapsed fraction of duration. */
|
|
29
|
+
private _t;
|
|
30
|
+
/** @private Captured at activation. */
|
|
31
|
+
private _duration;
|
|
32
|
+
_startX: number;
|
|
33
|
+
_startY: number;
|
|
34
|
+
_startZ: number;
|
|
35
|
+
_endX: number;
|
|
36
|
+
_endY: number;
|
|
37
|
+
_endZ: number;
|
|
38
|
+
canActivate(controller: any, runtime: any, sensors: any): boolean;
|
|
39
|
+
onActivate(controller: any, runtime: any): void;
|
|
40
|
+
canInterrupt(): boolean;
|
|
41
|
+
tick(controller: any, runtime: any, bodyTransform: any, dt: any, _system: any): boolean;
|
|
42
|
+
onDeactivate(_controller: any, _runtime: any): void;
|
|
43
|
+
}
|
|
44
|
+
import { Ability } from "./Ability.js";
|
|
45
|
+
//# sourceMappingURL=Mantle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mantle.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/control/first-person/abilities/Mantle.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;IAOQ,6CAA6C;IAC7C,WAAW;IACX,uCAAuC;IACvC,kBAAoB;IACpB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IACd,cAAc;IACd,cAAc;IAGlB,kEAwBC;IAED,gDAyCC;IAED,wBAGC;IAED,wFAwCC;IAED,oDAEC;CACJ;wBA1LuB,cAAc"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { FirstPersonPosture } from "../pose/FirstPersonPosture.js";
|
|
2
|
+
import { Ability } from "./Ability.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Smoothstep-style horizontal interpolation: slow-fast-slow.
|
|
6
|
+
* @param {number} t [0..1]
|
|
7
|
+
*/
|
|
8
|
+
function easeInOutCubic(t) {
|
|
9
|
+
return t < 0.5
|
|
10
|
+
? 4 * t * t * t
|
|
11
|
+
: 1 - Math.pow(-2 * t + 2, 3) / 2;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Front-loaded ease — fast rise then gentle settle. Used for the vertical
|
|
16
|
+
* curve so the body lifts off the ground quickly (matching the hand-grip
|
|
17
|
+
* pull-up dynamic) and decelerates as it approaches the surface top.
|
|
18
|
+
* @param {number} t [0..1]
|
|
19
|
+
*/
|
|
20
|
+
function easeOutCubic(t) {
|
|
21
|
+
return 1 - Math.pow(1 - t, 3);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Mantle ability — auto-triggers when the player walks/runs into a
|
|
26
|
+
* reachable obstacle with forward intent. The body follows a scripted
|
|
27
|
+
* parametric path (horizontal lerp on an ease-in-out, vertical lerp on
|
|
28
|
+
* an ease-out) for {@link cfg.mantle.duration} seconds, landing on top
|
|
29
|
+
* of the surface.
|
|
30
|
+
*
|
|
31
|
+
* Activation requires both `sensors.obstacleAhead.hit` (something in
|
|
32
|
+
* front to climb) AND `sensors.ledgeAhead.hit` (there's a top surface
|
|
33
|
+
* to land on). Heights between `cfg.mantle.minHeight` and `maxHeight`
|
|
34
|
+
* are accepted; below is "just step over", above is "out of reach".
|
|
35
|
+
*
|
|
36
|
+
* The ability is FULLY non-interruptible once committed — `canInterrupt`
|
|
37
|
+
* returns false throughout. This prevents the body from teleporting
|
|
38
|
+
* mid-mantle if a higher-priority ability fires; the trade-off is the
|
|
39
|
+
* player has limited control during the short window. Player input
|
|
40
|
+
* for THIS frame is effectively suspended.
|
|
41
|
+
*
|
|
42
|
+
* Priority 30: above Slide (10) so an obstacle vault-into preempts a
|
|
43
|
+
* slide; below Wall-run / Wall-jump so those high-air abilities still
|
|
44
|
+
* win if their conditions are simultaneously met (which would be
|
|
45
|
+
* unusual — typically you mantle from the ground).
|
|
46
|
+
*
|
|
47
|
+
* @author Alex Goldring
|
|
48
|
+
* @copyright Company Named Limited (c) 2026
|
|
49
|
+
*/
|
|
50
|
+
export class Mantle extends Ability {
|
|
51
|
+
constructor() {
|
|
52
|
+
super();
|
|
53
|
+
this.name = "Mantle";
|
|
54
|
+
this.priority = 30;
|
|
55
|
+
|
|
56
|
+
// -- per-instance scripted-path state --
|
|
57
|
+
/** @private Elapsed fraction of duration. */
|
|
58
|
+
this._t = 0;
|
|
59
|
+
/** @private Captured at activation. */
|
|
60
|
+
this._duration = 0.5;
|
|
61
|
+
this._startX = 0;
|
|
62
|
+
this._startY = 0;
|
|
63
|
+
this._startZ = 0;
|
|
64
|
+
this._endX = 0;
|
|
65
|
+
this._endY = 0;
|
|
66
|
+
this._endZ = 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
canActivate(controller, runtime, sensors) {
|
|
70
|
+
const cfg = controller.config.mantle;
|
|
71
|
+
if (!cfg) return false;
|
|
72
|
+
if (sensors === undefined || sensors === null) return false;
|
|
73
|
+
|
|
74
|
+
// Must have BOTH the face probe (obstacleAhead) AND the top probe
|
|
75
|
+
// (ledgeAhead) — otherwise we don't know if there's anywhere to
|
|
76
|
+
// land. obstacleAhead alone could be a wall too tall to climb.
|
|
77
|
+
if (!sensors.obstacleAhead.hit) return false;
|
|
78
|
+
if (!sensors.ledgeAhead.hit) return false;
|
|
79
|
+
|
|
80
|
+
// Forward intent is required — the player must be committing
|
|
81
|
+
// into the obstacle, otherwise we don't want to grab them.
|
|
82
|
+
if (controller.intent.move.y < 0.1) return false;
|
|
83
|
+
|
|
84
|
+
// Height check: the target surface must be within the reachable
|
|
85
|
+
// band.
|
|
86
|
+
const surfaceTopY = sensors.ledgeAhead.point.y;
|
|
87
|
+
const playerFootY = controller.pose.rootPosition.y;
|
|
88
|
+
const heightDiff = surfaceTopY - playerFootY;
|
|
89
|
+
if (heightDiff < cfg.minHeight) return false;
|
|
90
|
+
if (heightDiff > cfg.maxHeight) return false;
|
|
91
|
+
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
onActivate(controller, runtime) {
|
|
96
|
+
const cfg = controller.config.mantle;
|
|
97
|
+
const sensors = runtime.sensors;
|
|
98
|
+
|
|
99
|
+
this._t = 0;
|
|
100
|
+
this._duration = cfg.duration;
|
|
101
|
+
|
|
102
|
+
// Capture start position (body's current world position).
|
|
103
|
+
const startPos = controller.pose.rootPosition;
|
|
104
|
+
this._startX = startPos.x;
|
|
105
|
+
this._startY = startPos.y;
|
|
106
|
+
this._startZ = startPos.z;
|
|
107
|
+
|
|
108
|
+
// Compute end position: above the ledge surface, displaced
|
|
109
|
+
// forward by `forwardOffsetOnLand` so the player ends standing
|
|
110
|
+
// on the surface (not balancing on the edge).
|
|
111
|
+
const yaw = runtime.bodyYaw;
|
|
112
|
+
const fx = Math.sin(yaw);
|
|
113
|
+
const fz = Math.cos(yaw);
|
|
114
|
+
this._endX = sensors.ledgeAhead.point.x + fx * cfg.forwardOffsetOnLand;
|
|
115
|
+
this._endY = sensors.ledgeAhead.point.y;
|
|
116
|
+
this._endZ = sensors.ledgeAhead.point.z + fz * cfg.forwardOffsetOnLand;
|
|
117
|
+
|
|
118
|
+
// Zero velocity — the body is on a path, not under integration.
|
|
119
|
+
runtime.velocityX = 0;
|
|
120
|
+
runtime.velocityY = 0;
|
|
121
|
+
runtime.velocityZ = 0;
|
|
122
|
+
|
|
123
|
+
// Clear airborne/jump state — the scripted path supersedes them.
|
|
124
|
+
runtime.midJump = false;
|
|
125
|
+
runtime.apexFired = false;
|
|
126
|
+
controller.state.isVariableJumpCut = false;
|
|
127
|
+
controller.state.isAscending = false;
|
|
128
|
+
|
|
129
|
+
// Body is climbing — upright posture (not Hang, even if we got
|
|
130
|
+
// here from ledge-grab). Animators read posture for the rig
|
|
131
|
+
// blend; this signals "switch from the hang clip to the climb /
|
|
132
|
+
// upright clip".
|
|
133
|
+
controller.state.posture = FirstPersonPosture.Stand;
|
|
134
|
+
|
|
135
|
+
controller.signals.onLeaveGround.send1({ reason: "mantle" });
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
canInterrupt() {
|
|
139
|
+
// Non-interruptible. Mantle commits.
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
tick(controller, runtime, bodyTransform, dt, _system) {
|
|
144
|
+
// Body is on a scripted path — no lat-accel-driven lean. Hold
|
|
145
|
+
// the camera level for the duration of the mantle.
|
|
146
|
+
runtime.leanTargetRad = 0;
|
|
147
|
+
// Re-assert posture in case anything reset it. Mantle is a
|
|
148
|
+
// committed climb; we want the rig in the climb/stand blend
|
|
149
|
+
// until release.
|
|
150
|
+
controller.state.posture = FirstPersonPosture.Stand;
|
|
151
|
+
|
|
152
|
+
this._t += dt / this._duration;
|
|
153
|
+
|
|
154
|
+
if (this._t >= 1.0) {
|
|
155
|
+
// Completed: snap to end, mark grounded, release.
|
|
156
|
+
bodyTransform.position.set(this._endX, this._endY, this._endZ);
|
|
157
|
+
runtime.velocityX = 0;
|
|
158
|
+
runtime.velocityY = 0;
|
|
159
|
+
runtime.velocityZ = 0;
|
|
160
|
+
controller.state.grounded = true;
|
|
161
|
+
controller.state.verticalSpeed = 0;
|
|
162
|
+
controller.state.airborneTime = 0;
|
|
163
|
+
controller.state.timeSinceGrounded = 0;
|
|
164
|
+
controller.signals.onLand.send1({ verticalSpeed: 0, kind: "soft" });
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Sample the parametric path.
|
|
169
|
+
const horizT = easeInOutCubic(this._t);
|
|
170
|
+
const vertT = easeOutCubic(this._t);
|
|
171
|
+
bodyTransform.position.set(
|
|
172
|
+
this._startX + (this._endX - this._startX) * horizT,
|
|
173
|
+
this._startY + (this._endY - this._startY) * vertT,
|
|
174
|
+
this._startZ + (this._endZ - this._startZ) * horizT,
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
// Body is on a path — no integration this tick. Velocity stays 0.
|
|
178
|
+
runtime.velocityX = 0;
|
|
179
|
+
runtime.velocityY = 0;
|
|
180
|
+
runtime.velocityZ = 0;
|
|
181
|
+
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
onDeactivate(_controller, _runtime) {
|
|
186
|
+
this._t = 0;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slide ability — sprint + crouch-press while grounded transitions into
|
|
3
|
+
* a low-friction slide that preserves horizontal momentum. Exit on:
|
|
4
|
+
* - crouch released
|
|
5
|
+
* - horizontal speed falls below `cfg.slide.endSpeed`
|
|
6
|
+
* - airborne (lost ground contact)
|
|
7
|
+
* - jump pressed → fires a slide-jump (preserves momentum + adds jump
|
|
8
|
+
* impulse; the only way to exit while keeping all your speed)
|
|
9
|
+
*
|
|
10
|
+
* The ability has a non-interruptible startup window — once the player
|
|
11
|
+
* commits to a slide, higher-priority abilities can't yank them out for
|
|
12
|
+
* `cfg.slide.startupWindow` seconds. This protects the slide-jump
|
|
13
|
+
* timing window in particular: you can buffer a wall-jump press during
|
|
14
|
+
* slide-startup without losing the slide first.
|
|
15
|
+
*
|
|
16
|
+
* Priority is the lowest among movement abilities (10) — anything
|
|
17
|
+
* dynamic (wall-jump, mantle, ledge-grab) wins. Slide is the "default
|
|
18
|
+
* extension" of running.
|
|
19
|
+
*
|
|
20
|
+
* @author Alex Goldring
|
|
21
|
+
* @copyright Company Named Limited (c) 2026
|
|
22
|
+
*/
|
|
23
|
+
export class Slide extends Ability {
|
|
24
|
+
/** @private Counts down during the non-interruptible window. */
|
|
25
|
+
private _startupRemaining;
|
|
26
|
+
canActivate(controller: any, runtime: any, _sensors: any): boolean;
|
|
27
|
+
onActivate(controller: any, runtime: any): void;
|
|
28
|
+
canInterrupt(_controller: any, _runtime: any): boolean;
|
|
29
|
+
tick(controller: any, runtime: any, bodyTransform: any, dt: any, system: any): boolean;
|
|
30
|
+
onDeactivate(_controller: any, _runtime: any): void;
|
|
31
|
+
}
|
|
32
|
+
import { Ability } from "./Ability.js";
|
|
33
|
+
//# sourceMappingURL=Slide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slide.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/control/first-person/abilities/Slide.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAOQ,gEAAgE;IAChE,0BAA0B;IAG9B,mEAeC;IAED,gDAuBC;IAED,uDAGC;IAED,uFAmEC;IAED,oDAEC;CACJ;wBA1JuB,cAAc"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { DecisionPoint } from "../mastery/DecisionPoint.js";
|
|
2
|
+
import { FirstPersonLocomotionMode } from "../pose/FirstPersonPose.js";
|
|
3
|
+
import { FirstPersonPosture } from "../pose/FirstPersonPosture.js";
|
|
4
|
+
import { Ability } from "./Ability.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Slide ability — sprint + crouch-press while grounded transitions into
|
|
8
|
+
* a low-friction slide that preserves horizontal momentum. Exit on:
|
|
9
|
+
* - crouch released
|
|
10
|
+
* - horizontal speed falls below `cfg.slide.endSpeed`
|
|
11
|
+
* - airborne (lost ground contact)
|
|
12
|
+
* - jump pressed → fires a slide-jump (preserves momentum + adds jump
|
|
13
|
+
* impulse; the only way to exit while keeping all your speed)
|
|
14
|
+
*
|
|
15
|
+
* The ability has a non-interruptible startup window — once the player
|
|
16
|
+
* commits to a slide, higher-priority abilities can't yank them out for
|
|
17
|
+
* `cfg.slide.startupWindow` seconds. This protects the slide-jump
|
|
18
|
+
* timing window in particular: you can buffer a wall-jump press during
|
|
19
|
+
* slide-startup without losing the slide first.
|
|
20
|
+
*
|
|
21
|
+
* Priority is the lowest among movement abilities (10) — anything
|
|
22
|
+
* dynamic (wall-jump, mantle, ledge-grab) wins. Slide is the "default
|
|
23
|
+
* extension" of running.
|
|
24
|
+
*
|
|
25
|
+
* @author Alex Goldring
|
|
26
|
+
* @copyright Company Named Limited (c) 2026
|
|
27
|
+
*/
|
|
28
|
+
export class Slide extends Ability {
|
|
29
|
+
constructor() {
|
|
30
|
+
super();
|
|
31
|
+
this.name = "Slide";
|
|
32
|
+
/** Lowest of the movement abilities. Wall-jump, mantle, etc. preempt. */
|
|
33
|
+
this.priority = 10;
|
|
34
|
+
|
|
35
|
+
/** @private Counts down during the non-interruptible window. */
|
|
36
|
+
this._startupRemaining = 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
canActivate(controller, runtime, _sensors) {
|
|
40
|
+
const cfg = controller.config.slide;
|
|
41
|
+
if (!cfg) return false; // slide config not present
|
|
42
|
+
if (!controller.state.grounded) return false;
|
|
43
|
+
if (!controller.intent.crouch) return false;
|
|
44
|
+
// Rising-edge crouch — runtime.prevCrouchHeld tracks the last frame's
|
|
45
|
+
// intent.crouch. If both are true we're past the press; require an
|
|
46
|
+
// actual transition. (Without this, the player could enter slide
|
|
47
|
+
// simply by holding crouch and walking up to sprint speed.)
|
|
48
|
+
if (runtime.prevCrouchHeld) return false;
|
|
49
|
+
// Need significant horizontal speed — slide is a run-into-slide,
|
|
50
|
+
// not a standstill-into-slide.
|
|
51
|
+
const speed = Math.hypot(runtime.velocityX, runtime.velocityZ);
|
|
52
|
+
if (speed < cfg.minEntrySpeed) return false;
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onActivate(controller, runtime) {
|
|
57
|
+
const cfg = controller.config.slide;
|
|
58
|
+
this._startupRemaining = cfg.startupWindow;
|
|
59
|
+
|
|
60
|
+
// Mastery: scale entry velocity preservation. Well-timed slides
|
|
61
|
+
// (stride midstance) bias the multiplier above 1.0; poorly-timed
|
|
62
|
+
// (foot-strike) bias it below. Default no-evaluator multiplier
|
|
63
|
+
// is 1.0 = exact velocity preservation. See
|
|
64
|
+
// {@link SlideInitiationTimingEvaluator}.
|
|
65
|
+
const masteryMul = controller.mastery.evaluate(
|
|
66
|
+
DecisionPoint.SlideEntryVelocity, controller, runtime,
|
|
67
|
+
);
|
|
68
|
+
runtime.velocityX *= masteryMul;
|
|
69
|
+
runtime.velocityZ *= masteryMul;
|
|
70
|
+
|
|
71
|
+
// Body is now horizontal — head close to ground, no striding
|
|
72
|
+
// feet. L2 reads posture to set eye height and gate gait
|
|
73
|
+
// (stride / footstep / bob).
|
|
74
|
+
controller.state.posture = FirstPersonPosture.Prone;
|
|
75
|
+
|
|
76
|
+
// Visual: kick the vertical impact spring downward for the entry
|
|
77
|
+
// "thud" — the camera dip that sells the body dropping into the slide.
|
|
78
|
+
runtime.verticalImpactSpring.kick(-cfg.entryImpactVelocity);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
canInterrupt(_controller, _runtime) {
|
|
82
|
+
// Non-interruptible during the startup window.
|
|
83
|
+
return this._startupRemaining <= 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
tick(controller, runtime, bodyTransform, dt, system) {
|
|
87
|
+
const cfg = controller.config.slide;
|
|
88
|
+
|
|
89
|
+
// Keep posture pinned each tick — if the base were to run
|
|
90
|
+
// before us on a release tick it would overwrite to Stand/Crouch;
|
|
91
|
+
// re-asserting here keeps L2 consistent across the slide.
|
|
92
|
+
controller.state.posture = FirstPersonPosture.Prone;
|
|
93
|
+
// No camera lean during slide — body is flat, head is pinned
|
|
94
|
+
// forward along the direction of travel.
|
|
95
|
+
runtime.leanTargetRad = 0;
|
|
96
|
+
|
|
97
|
+
// -- Tick the startup window (always counts down).
|
|
98
|
+
this._startupRemaining = Math.max(0, this._startupRemaining - dt);
|
|
99
|
+
|
|
100
|
+
// -- Exit conditions (checked FIRST, before any motion this tick).
|
|
101
|
+
// Released crouch.
|
|
102
|
+
if (!controller.intent.crouch) return false;
|
|
103
|
+
// Airborne.
|
|
104
|
+
if (!controller.state.grounded) return false;
|
|
105
|
+
// Speed dropped below floor — but only after the startup window
|
|
106
|
+
// (otherwise momentarily-low speed entries would auto-exit before
|
|
107
|
+
// the player has felt the slide).
|
|
108
|
+
const speed = Math.hypot(runtime.velocityX, runtime.velocityZ);
|
|
109
|
+
if (this._startupRemaining <= 0 && speed < cfg.endSpeed) return false;
|
|
110
|
+
|
|
111
|
+
// -- Slide-jump: if jump was pressed (rising edge), apply impulse
|
|
112
|
+
// and release. Base will integrate the new vy on the same tick.
|
|
113
|
+
const jumpPressedEdge = controller.intent.jump && !runtime.prevJumpHeld;
|
|
114
|
+
// Note: we DO consume the jump-pressed edge here even though the
|
|
115
|
+
// jump FSM also reads it. Setting prevJumpHeld now means the FSM
|
|
116
|
+
// (which runs in base after we release) sees no rising edge and
|
|
117
|
+
// doesn't double-fire a normal jump.
|
|
118
|
+
runtime.prevJumpHeld = controller.intent.jump;
|
|
119
|
+
if (jumpPressedEdge) {
|
|
120
|
+
runtime.velocityY = runtime.jumpInitialVy * cfg.slideJumpUpFactor;
|
|
121
|
+
runtime.midJump = true;
|
|
122
|
+
runtime.apexFired = false;
|
|
123
|
+
runtime.peakAltitude = bodyTransform.position.y;
|
|
124
|
+
controller.state.isVariableJumpCut = false;
|
|
125
|
+
controller.state.isAscending = true;
|
|
126
|
+
// Mastery: scale the impulse via JumpImpulse evaluators if any.
|
|
127
|
+
// We deliberately reuse JumpImpulse rather than introducing a
|
|
128
|
+
// separate SlideJumpImpulse decision point — the player's
|
|
129
|
+
// skill at timing applies the same way.
|
|
130
|
+
// (Skipping for simplicity in this version; would mirror the
|
|
131
|
+
// base controller's mastery application.)
|
|
132
|
+
controller.signals.onJumpStart.send1({ peakHeight: controller.config.jump.peakHeight });
|
|
133
|
+
controller.signals.onLeaveGround.send1({ reason: "jump" });
|
|
134
|
+
return false; // release; base handles integration this tick
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// -- Motion: slide friction on horizontal velocity. Direction is
|
|
138
|
+
// preserved (no steering in this minimal version — carving can
|
|
139
|
+
// be added later as an evaluator-curve-driven term).
|
|
140
|
+
if (speed > 1e-6) {
|
|
141
|
+
const newSpeed = Math.max(0, speed - cfg.friction * dt);
|
|
142
|
+
const ratio = newSpeed / speed;
|
|
143
|
+
runtime.velocityX *= ratio;
|
|
144
|
+
runtime.velocityZ *= ratio;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// -- Vertical phase: delegate to the system's standard
|
|
148
|
+
// gravity + integrate + ground resolution. Slide doesn't have
|
|
149
|
+
// its own vertical model.
|
|
150
|
+
system._integrateVerticalAndResolveGround(controller, runtime, bodyTransform, dt);
|
|
151
|
+
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
onDeactivate(_controller, _runtime) {
|
|
156
|
+
this._startupRemaining = 0;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wall-jump ability — instantaneous off-wall impulse fired when the
|
|
3
|
+
* player presses jump while close to a wall. Designed to chain
|
|
4
|
+
* naturally from wall-run (its priority is higher, so it preempts wall-
|
|
5
|
+
* run's `canInterrupt()=true`) but ALSO fires from "near-wall airborne"
|
|
6
|
+
* — a window where the player is mid-jump near a wall they haven't
|
|
7
|
+
* committed to running.
|
|
8
|
+
*
|
|
9
|
+
* Activation:
|
|
10
|
+
* - intent.jump just went true (rising edge)
|
|
11
|
+
* - airborne (`!state.grounded`)
|
|
12
|
+
* - a side wall sensor has hit within `nearWallMaxDistance`
|
|
13
|
+
*
|
|
14
|
+
* Behaviour:
|
|
15
|
+
* - Apply impulse: `outwardImpulse * wall.normal + upImpulse * worldUp`
|
|
16
|
+
* where `upImpulse = jumpInitialVy * upFactor`.
|
|
17
|
+
* - Clear variableJumpCut so the impulse takes effect cleanly.
|
|
18
|
+
* - Fire `onJumpStart` and `onLeaveGround{reason:"walljump"}` signals.
|
|
19
|
+
* - Releases immediately (it's instantaneous, not a sustained state).
|
|
20
|
+
*
|
|
21
|
+
* The impulse goes through `mastery.evaluate(DecisionPoint.WallJumpImpulse)`
|
|
22
|
+
* so any registered evaluators (e.g. breath rhythm, wall-jump-angle
|
|
23
|
+
* timing) can scale it.
|
|
24
|
+
*
|
|
25
|
+
* Priority 60 — highest among movement abilities. Wall-jump must fire
|
|
26
|
+
* reliably on player press, so it preempts wall-run (50), mantle (30),
|
|
27
|
+
* and slide (10).
|
|
28
|
+
*
|
|
29
|
+
* @author Alex Goldring
|
|
30
|
+
* @copyright Company Named Limited (c) 2026
|
|
31
|
+
*/
|
|
32
|
+
export class WallJump extends Ability {
|
|
33
|
+
canActivate(controller: any, runtime: any, sensors: any): boolean;
|
|
34
|
+
onActivate(controller: any, runtime: any): void;
|
|
35
|
+
/**
|
|
36
|
+
* Wall-jump is instantaneous — it shouldn't ever be "interrupted".
|
|
37
|
+
* tick() returns false on first call so the ability releases
|
|
38
|
+
* immediately. Returning false here doesn't matter (no other ability
|
|
39
|
+
* exceeds priority 60 in the default set).
|
|
40
|
+
*/
|
|
41
|
+
canInterrupt(): boolean;
|
|
42
|
+
tick(_controller: any, _runtime: any, _bodyTransform: any, _dt: any, _system: any): boolean;
|
|
43
|
+
}
|
|
44
|
+
import { Ability } from "./Ability.js";
|
|
45
|
+
//# sourceMappingURL=WallJump.d.ts.map
|