@woosh/meep-engine 2.154.0 → 2.156.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/README.md +1 -1
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/editor/view/ecs/ComponentControlView.d.ts +0 -9
- package/editor/view/ecs/ComponentControlView.js +2 -98
- package/package.json +1 -1
- package/src/core/binary/32BitEncoder.js +1 -1
- package/src/core/binary/to_half_float_uint16.js +3 -3
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy_radix.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy_radix.js +275 -253
- package/src/core/cache/Cache.d.ts.map +1 -1
- package/src/core/cache/Cache.js +7 -0
- package/src/core/cache/FrequencySketch.d.ts.map +1 -1
- package/src/core/cache/FrequencySketch.js +8 -4
- package/src/core/clipboard/obtainClipBoard.d.ts +6 -0
- package/src/core/clipboard/obtainClipBoard.d.ts.map +1 -0
- package/src/core/clipboard/obtainClipBoard.js +29 -0
- package/src/core/clipboard/safeClipboardReadText.d.ts +6 -0
- package/src/core/clipboard/safeClipboardReadText.d.ts.map +1 -0
- package/src/core/clipboard/safeClipboardReadText.js +55 -0
- package/src/core/clipboard/safeClipboardWriteText.d.ts +8 -0
- package/src/core/clipboard/safeClipboardWriteText.d.ts.map +1 -0
- package/src/core/clipboard/safeClipboardWriteText.js +23 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_map.js +1 -1
- package/src/core/collection/array/array_set_diff_sorting.d.ts.map +1 -1
- package/src/core/collection/array/array_set_diff_sorting.js +4 -1
- package/src/core/collection/array/array_shuffle.d.ts.map +1 -1
- package/src/core/collection/array/array_shuffle.js +30 -27
- package/src/core/collection/array/binarySearchLowIndex.d.ts.map +1 -1
- package/src/core/collection/array/binarySearchLowIndex.js +4 -3
- package/src/core/collection/array/typed/array_buffer_hash.js +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.d.ts.map +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.js +12 -2
- package/src/core/collection/heap/BinaryHeap.d.ts.map +1 -1
- package/src/core/collection/heap/BinaryHeap.js +12 -2
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +10 -8
- package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
- package/src/core/collection/table/RowFirstTable.js +4 -2
- package/src/core/collection/table/RowFirstTableSpec.js +2 -2
- package/src/core/color/operations/color_lerp.d.ts.map +1 -1
- package/src/core/color/operations/color_lerp.js +10 -3
- package/src/core/color/rgb2uint32.js +1 -1
- package/src/core/color/rgbe9995_to_rgb.js +1 -1
- package/src/core/function/objectsEqual.d.ts.map +1 -1
- package/src/core/function/objectsEqual.js +2 -1
- package/src/core/geom/2d/aabb/AABB2.d.ts.map +1 -1
- package/src/core/geom/2d/aabb/AABB2.js +12 -11
- package/src/core/geom/2d/convex-hull/convex_hull_jarvis_2d.d.ts.map +1 -1
- package/src/core/geom/2d/convex-hull/convex_hull_jarvis_2d.js +30 -4
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.d.ts.map +1 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +6 -2
- package/src/core/geom/2d/hash-grid/SpatialHashGrid.d.ts.map +1 -1
- package/src/core/geom/2d/hash-grid/SpatialHashGrid.js +388 -386
- package/src/core/geom/2d/hash-grid/shg_query_elements_line.d.ts.map +1 -1
- package/src/core/geom/2d/hash-grid/shg_query_elements_line.js +8 -3
- package/src/core/geom/2d/quad-tree/QuadTreeDatum.d.ts.map +1 -1
- package/src/core/geom/2d/quad-tree/QuadTreeDatum.js +9 -1
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.d.ts +3 -1
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.d.ts.map +1 -1
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.js +3 -1
- package/src/core/geom/2d/quad-tree-binary/QuadTree.js +714 -714
- package/src/core/geom/2d/r-tree/StaticR2Tree.d.ts.map +1 -1
- package/src/core/geom/2d/r-tree/StaticR2Tree.js +5 -4
- package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.js +33 -29
- package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.js +3 -1
- package/src/core/geom/3d/aabb/aabb3_signed_distance_to_aabb3.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_signed_distance_to_aabb3.js +10 -7
- package/src/core/geom/3d/aabb/aabb3_transformed_compute_plane_side.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_transformed_compute_plane_side.js +30 -9
- package/src/core/geom/3d/aabb/compute_aabb_from_points.js +3 -3
- package/src/core/geom/3d/box/box3_raycast.d.ts +37 -0
- package/src/core/geom/3d/box/box3_raycast.d.ts.map +1 -0
- package/src/core/geom/3d/box/box3_raycast.js +81 -0
- package/src/core/geom/3d/capsule/capsule_raycast.d.ts +35 -0
- package/src/core/geom/3d/capsule/capsule_raycast.d.ts.map +1 -0
- package/src/core/geom/3d/capsule/capsule_raycast.js +93 -0
- package/src/core/geom/3d/cone/compute_bounding_cone_of_2_cones.d.ts.map +1 -1
- package/src/core/geom/3d/cone/compute_bounding_cone_of_2_cones.js +4 -0
- package/src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +1 -1
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.d.ts.map +1 -1
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.js +3 -2
- package/src/core/geom/3d/mat4/decompose_matrix_4_array.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/decompose_matrix_4_array.js +12 -2
- package/src/core/geom/3d/mat4/eulerAnglesFromMatrix.js +2 -2
- package/src/core/geom/3d/mat4/m4_multiply_alphatensor.d.ts +1 -1
- package/src/core/geom/3d/mat4/m4_multiply_alphatensor.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/m4_multiply_alphatensor.js +19 -13
- package/src/core/geom/3d/octahedra/octahedral_direction_to_uv.d.ts.map +1 -1
- package/src/core/geom/3d/octahedra/octahedral_direction_to_uv.js +3 -2
- package/src/core/geom/3d/plane/plane3_compute_plane_intersection.js +3 -2
- package/src/core/geom/3d/shape/MeshShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/MeshShape3D.js +7 -0
- package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnionShape3D.js +3 -2
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.d.ts.map +1 -1
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.js +153 -148
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +7 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.js +13 -10
- package/src/core/geom/3d/sphere/sphere_projected_sphere_radius_sqr.d.ts +1 -1
- package/src/core/geom/3d/sphere/sphere_projected_sphere_radius_sqr.js +2 -2
- package/src/core/geom/3d/sphere/sphere_raycast.d.ts +33 -0
- package/src/core/geom/3d/sphere/sphere_raycast.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/sphere_raycast.js +47 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.d.ts +24 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.js +39 -0
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.js +4 -2
- package/src/core/geom/3d/topology/bounds/computeTriangleClusterNormalBoundingCone.js +3 -3
- package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +1 -1
- package/src/core/geom/3d/topology/tm_vertex_compute_normal.d.ts.map +1 -1
- package/src/core/geom/3d/topology/tm_vertex_compute_normal.js +4 -2
- package/src/core/geom/3d/util/make_justified_point_grid.d.ts.map +1 -1
- package/src/core/geom/3d/util/make_justified_point_grid.js +18 -10
- package/src/core/geom/ConicRay.d.ts.map +1 -1
- package/src/core/geom/ConicRay.js +11 -13
- package/src/core/geom/packing/max-rect/removeRedundantBoxes.d.ts.map +1 -1
- package/src/core/geom/packing/max-rect/removeRedundantBoxes.js +19 -4
- package/src/core/geom/vec3/v3_array_copy.d.ts +3 -3
- package/src/core/geom/vec3/v3_array_copy.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_array_copy.js +2 -2
- package/src/core/geom/vec3/v3_cross.d.ts +17 -0
- package/src/core/geom/vec3/v3_cross.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_cross.js +20 -0
- package/src/core/geom/vec3/v3_orthonormal_matrix_from_normal.d.ts.map +1 -0
- package/src/{engine/graphics/sh3/path_tracer/sampling → core/geom/vec3}/v3_orthonormal_matrix_from_normal.js +1 -1
- package/src/core/geom/vec3/v3_subtract.d.ts +16 -0
- package/src/core/geom/vec3/v3_subtract.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_subtract.js +19 -0
- package/src/core/graph/coloring/colorizeGraph.js +2 -2
- package/src/core/graph/csr/CSRGraph.d.ts.map +1 -1
- package/src/core/graph/csr/CSRGraph.js +325 -319
- package/src/core/graph/layout/CircleLayout.d.ts.map +1 -1
- package/src/core/graph/layout/CircleLayout.js +8 -6
- package/src/core/graph/metis/native/refine/compute_kway_params.d.ts.map +1 -1
- package/src/core/graph/metis/native/refine/compute_kway_params.js +139 -138
- package/src/core/graph/mn_graph_coarsen.d.ts.map +1 -1
- package/src/core/graph/mn_graph_coarsen.js +4 -2
- package/src/core/graph/v2/NodeContainer.js +7 -7
- package/src/core/localization/LocalizationEngine.js +1 -1
- package/src/core/math/bell_membership_function.d.ts.map +1 -1
- package/src/core/math/bell_membership_function.js +3 -1
- package/src/core/math/complex/complex_add.d.ts +4 -4
- package/src/core/math/complex/complex_add.d.ts.map +1 -1
- package/src/core/math/complex/complex_add.js +3 -3
- package/src/core/math/complex/complex_div.d.ts +4 -4
- package/src/core/math/complex/complex_div.d.ts.map +1 -1
- package/src/core/math/complex/complex_div.js +3 -3
- package/src/core/math/complex/complex_mul.d.ts +4 -4
- package/src/core/math/complex/complex_mul.d.ts.map +1 -1
- package/src/core/math/complex/complex_mul.js +3 -3
- package/src/core/math/complex/complex_sub.d.ts +4 -4
- package/src/core/math/complex/complex_sub.d.ts.map +1 -1
- package/src/core/math/complex/complex_sub.js +3 -3
- package/src/core/math/idct_1d.d.ts +4 -4
- package/src/core/math/idct_1d.d.ts.map +1 -1
- package/src/core/math/idct_1d.js +3 -3
- package/src/core/math/noise/create_simplex_noise_2d.d.ts.map +1 -1
- package/src/core/math/noise/create_simplex_noise_2d.js +4 -2
- package/src/core/math/noise/sdnoise.d.ts.map +1 -1
- package/src/core/math/noise/sdnoise.js +12 -9
- package/src/core/math/physics/mie/compute_bhmie_optical_properties.d.ts.map +1 -1
- package/src/core/math/physics/mie/compute_bhmie_optical_properties.js +94 -50
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts +3 -6
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts.map +1 -1
- package/src/core/math/physics/mie/lorenz_mie_coefs.js +180 -157
- package/src/core/math/physics/mie/mie_ab_to_optical_properties.d.ts +3 -4
- package/src/core/math/physics/mie/mie_ab_to_optical_properties.d.ts.map +1 -1
- package/src/core/math/physics/mie/mie_ab_to_optical_properties.js +47 -21
- package/src/core/math/random/randomIntegerBetween.d.ts.map +1 -1
- package/src/core/math/random/randomIntegerBetween.js +4 -1
- package/src/core/math/solveCubic.d.ts.map +1 -1
- package/src/core/math/solveCubic.js +95 -82
- package/src/core/math/spline/computeCatmullRomSplineUniformDistance.d.ts.map +1 -1
- package/src/core/math/spline/computeCatmullRomSplineUniformDistance.js +13 -0
- package/src/core/math/statistics/softmax.js +1 -1
- package/src/core/model/node-graph/visual/NodeGraphVisualData.d.ts +1 -0
- package/src/core/model/node-graph/visual/NodeGraphVisualData.d.ts.map +1 -1
- package/src/core/model/node-graph/visual/NodeGraphVisualData.js +2 -1
- package/src/core/model/node-graph/visual/NodeVisualData.js +1 -1
- package/src/core/model/object/ImmutableObjectPool.d.ts +7 -0
- package/src/core/model/object/ImmutableObjectPool.d.ts.map +1 -1
- package/src/core/model/object/ImmutableObjectPool.js +20 -10
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.d.ts.map +1 -1
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.js +39 -2
- package/src/core/model/reactive/model/terminal/ReactiveReference.d.ts.map +1 -1
- package/src/core/model/reactive/model/terminal/ReactiveReference.js +2 -0
- package/src/core/parser/simple/readHexToken.d.ts.map +1 -1
- package/src/core/parser/simple/readHexToken.js +6 -0
- package/src/core/primitives/numbers/number_pretty_print.d.ts.map +1 -1
- package/src/core/primitives/numbers/number_pretty_print.js +4 -1
- package/src/core/primitives/strings/string_jaro_winkler.js +1 -1
- package/src/core/process/CompositeProcess.js +1 -1
- package/src/core/process/action/AsynchronousDelayAction.d.ts.map +1 -1
- package/src/core/process/action/AsynchronousDelayAction.js +3 -0
- package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
- package/src/core/process/executor/ConcurrentExecutor.js +3 -2
- package/src/core/process/task/util/randomCountTask.d.ts.map +1 -1
- package/src/core/process/task/util/randomCountTask.js +3 -1
- package/src/core/process/undo/ActionProcessor.d.ts.map +1 -1
- package/src/core/process/undo/ActionProcessor.js +5 -3
- package/src/core/process/worker/WorkerBuilder.js +3 -3
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +4 -2
- package/src/engine/control/first-person/DESIGN.md +1 -1
- package/src/engine/control/first-person/FirstPersonMotionPhase.d.ts +55 -0
- package/src/engine/control/first-person/FirstPersonMotionPhase.d.ts.map +1 -0
- package/src/engine/control/first-person/FirstPersonMotionPhase.js +134 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +23 -2
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerController.js +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +168 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +115 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +71 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +255 -55
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts +82 -43
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/LedgeGrab.js +405 -213
- package/src/engine/control/first-person/abilities/Mantle.d.ts +6 -0
- package/src/engine/control/first-person/abilities/Mantle.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/Mantle.js +104 -45
- package/src/engine/control/first-person/abilities/ScrambleUp.d.ts +61 -0
- package/src/engine/control/first-person/abilities/ScrambleUp.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/ScrambleUp.js +182 -0
- package/src/engine/control/first-person/math/jumpDynamics.d.ts +84 -0
- package/src/engine/control/first-person/math/jumpDynamics.d.ts.map +1 -0
- package/src/engine/control/first-person/math/jumpDynamics.js +108 -0
- package/src/engine/control/first-person/prototype_first_person_controller.js +45 -1
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +1 -1
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +8 -0
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +1 -1
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -1
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +1 -1
- package/src/engine/graphics/shadows/testShadowMapRendering.js +1 -1
- package/src/engine/physics/CONSTRAINT_SOLVER_BENCH_LOG.md +208 -0
- package/src/engine/physics/CONSTRAINT_SOLVER_IMPROVEMENTS_PLAN.md +364 -0
- package/src/engine/physics/PLAN.md +6 -5
- package/src/engine/physics/constraint/solve_constraints.d.ts +4 -1
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
- package/src/engine/physics/constraint/solve_constraints.js +147 -33
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +1750 -1747
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
- package/src/engine/physics/gjk/gjk_epa_penetration.d.ts +12 -8
- package/src/engine/physics/gjk/gjk_epa_penetration.d.ts.map +1 -1
- package/src/engine/physics/gjk/gjk_epa_penetration.js +447 -158
- package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/convex_convex_manifold.js +22 -25
- package/src/engine/physics/narrowphase/convex_decomposition.d.ts +32 -13
- package/src/engine/physics/narrowphase/convex_decomposition.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/convex_decomposition.js +61 -65
- package/src/engine/physics/narrowphase/mesh_convex_hull.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/mesh_convex_hull.js +13 -8
- package/src/engine/physics/narrowphase/refine_ray_concave.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/refine_ray_concave.js +5 -3
- package/src/engine/physics/narrowphase/refine_ray_hit.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/refine_ray_hit.js +81 -78
- package/src/engine/sound/SoundEngine.d.ts.map +1 -1
- package/src/engine/sound/SoundEngine.js +28 -0
- package/src/engine/sound/dB2Volume.d.ts +1 -1
- package/src/engine/sound/dB2Volume.d.ts.map +1 -1
- package/src/engine/sound/dB2Volume.js +1 -1
- package/src/engine/sound/ecs/SoundController.d.ts +4 -0
- package/src/engine/sound/ecs/SoundController.d.ts.map +1 -1
- package/src/engine/sound/ecs/SoundController.js +4 -0
- package/src/engine/sound/ecs/SoundControllerSystem.d.ts +5 -0
- package/src/engine/sound/ecs/SoundControllerSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/SoundControllerSystem.js +5 -0
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts +69 -0
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/AudioEmitter.js +83 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts +97 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +238 -0
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts +90 -0
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/LiveEmitterSet.js +324 -0
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.d.ts +59 -0
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.js +140 -0
- package/src/engine/sound/ecs/emitter/SoundEmitter.d.ts +16 -65
- package/src/engine/sound/ecs/emitter/SoundEmitter.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitter.js +19 -224
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.d.ts +26 -29
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.js +168 -135
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts +36 -59
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +154 -390
- package/src/engine/sound/ecs/emitter/SoundTrack.d.ts +20 -23
- package/src/engine/sound/ecs/emitter/SoundTrack.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundTrack.js +34 -152
- package/src/engine/sound/sopra/IMPLEMENTATION_PLAN.md +993 -0
- package/src/engine/sound/sopra/README.md +643 -7
- package/src/engine/sound/sopra/SopraEngine.d.ts +229 -0
- package/src/engine/sound/sopra/SopraEngine.d.ts.map +1 -0
- package/src/engine/sound/sopra/SopraEngine.js +423 -0
- package/src/engine/sound/sopra/asset/AssetManagerBufferProvider.d.ts +26 -0
- package/src/engine/sound/sopra/asset/AssetManagerBufferProvider.d.ts.map +1 -0
- package/src/engine/sound/sopra/asset/AssetManagerBufferProvider.js +71 -0
- package/src/engine/sound/sopra/asset/BufferProvider.d.ts +24 -0
- package/src/engine/sound/sopra/asset/BufferProvider.d.ts.map +1 -0
- package/src/engine/sound/sopra/asset/BufferProvider.js +29 -0
- package/src/engine/sound/sopra/asset/StubBufferProvider.d.ts +31 -0
- package/src/engine/sound/sopra/asset/StubBufferProvider.d.ts.map +1 -0
- package/src/engine/sound/sopra/asset/StubBufferProvider.js +58 -0
- package/src/engine/sound/sopra/definition/BusDefinition.d.ts +83 -0
- package/src/engine/sound/sopra/definition/BusDefinition.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/BusDefinition.js +142 -0
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.js +54 -0
- package/src/engine/sound/sopra/definition/DuckingRule.d.ts +71 -0
- package/src/engine/sound/sopra/definition/DuckingRule.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/DuckingRule.js +106 -0
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.js +31 -0
- package/src/engine/sound/sopra/definition/EventDescription.d.ts +132 -0
- package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/EventDescription.js +259 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.js +71 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.d.ts +51 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.js +83 -0
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.js +39 -0
- package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts +72 -0
- package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/ParameterDefinition.js +117 -0
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.js +31 -0
- package/src/engine/sound/sopra/definition/SopraPanningModel.d.ts +14 -0
- package/src/engine/sound/sopra/definition/SopraPanningModel.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/SopraPanningModel.js +20 -0
- package/src/engine/sound/sopra/definition/VoiceStealMode.d.ts +10 -0
- package/src/engine/sound/sopra/definition/VoiceStealMode.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/VoiceStealMode.js +18 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.d.ts +93 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.js +109 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts +80 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.js +181 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.js +74 -0
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.d.ts +34 -0
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.js +100 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts +101 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.js +230 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.js +54 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts +103 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.js +191 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.js +39 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.d.ts +40 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.js +91 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.js +42 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.d.ts +44 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.js +77 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.js +27 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +65 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.js +131 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.js +41 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts +24 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.js +24 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts +70 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.js +120 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.js +31 -0
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts +74 -0
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/EqEffect.js +128 -0
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.js +29 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts +49 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +101 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.js +25 -0
- package/src/engine/sound/sopra/legacy/soundEmitterToEventDescription.d.ts +31 -0
- package/src/engine/sound/sopra/legacy/soundEmitterToEventDescription.d.ts.map +1 -0
- package/src/engine/sound/sopra/legacy/soundEmitterToEventDescription.js +106 -0
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts +79 -0
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/BusGraph.js +227 -0
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts +144 -0
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/EventInstance.js +579 -0
- package/src/engine/sound/sopra/runtime/ParameterStore.d.ts +42 -0
- package/src/engine/sound/sopra/runtime/ParameterStore.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/ParameterStore.js +98 -0
- package/src/engine/sound/sopra/runtime/SopraPlaybackContext.d.ts +42 -0
- package/src/engine/sound/sopra/runtime/SopraPlaybackContext.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/SopraPlaybackContext.js +68 -0
- package/src/engine/sound/sopra/runtime/Voice.d.ts +67 -0
- package/src/engine/sound/sopra/runtime/Voice.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/Voice.js +145 -0
- package/src/engine/sound/sopra/runtime/VoiceManager.d.ts +38 -0
- package/src/engine/sound/sopra/runtime/VoiceManager.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/VoiceManager.js +136 -0
- package/src/engine/sound/sopra/runtime/VoicePool.d.ts +12 -0
- package/src/engine/sound/sopra/runtime/VoicePool.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/VoicePool.js +17 -0
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts +11 -0
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts.map +1 -0
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.js +42 -0
- package/src/engine/sound/sopra/serialization/sopraJSON.d.ts +33 -0
- package/src/engine/sound/sopra/serialization/sopraJSON.d.ts.map +1 -0
- package/src/engine/sound/sopra/serialization/sopraJSON.js +99 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts +27 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts.map +1 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.js +49 -0
- package/src/engine/sound/sopra/util/MockAudioContext.d.ts +74 -0
- package/src/engine/sound/sopra/util/MockAudioContext.d.ts.map +1 -0
- package/src/engine/sound/sopra/util/MockAudioContext.js +215 -0
- package/src/engine/sound/sopra/util/buildAttenuationCurve.d.ts +15 -0
- package/src/engine/sound/sopra/util/buildAttenuationCurve.d.ts.map +1 -0
- package/src/engine/sound/sopra/util/buildAttenuationCurve.js +40 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts +34 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts.map +1 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.js +60 -0
- package/src/engine/sound/volume2dB.d.ts +1 -1
- package/src/engine/sound/volume2dB.d.ts.map +1 -1
- package/src/engine/sound/volume2dB.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/v3_orthonormal_matrix_from_normal.d.ts.map +0 -1
- package/src/engine/physics/narrowphase/ray_shapes.d.ts +0 -66
- package/src/engine/physics/narrowphase/ray_shapes.d.ts.map +0 -1
- package/src/engine/physics/narrowphase/ray_shapes.js +0 -187
- package/src/engine/sound/ecs/emitter/SoundEmitterChannel.d.ts +0 -23
- package/src/engine/sound/ecs/emitter/SoundEmitterChannel.d.ts.map +0 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterChannel.js +0 -32
- package/src/engine/sound/ecs/emitter/SoundTrackNodes.d.ts +0 -18
- package/src/engine/sound/ecs/emitter/SoundTrackNodes.d.ts.map +0 -1
- package/src/engine/sound/ecs/emitter/SoundTrackNodes.js +0 -18
- package/src/engine/sound/sopra/AbstractAudioClip.d.ts +0 -26
- package/src/engine/sound/sopra/AbstractAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/AbstractAudioClip.js +0 -29
- package/src/engine/sound/sopra/ContainerAudioClip.d.ts +0 -12
- package/src/engine/sound/sopra/ContainerAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/ContainerAudioClip.js +0 -13
- package/src/engine/sound/sopra/RandomContainerAudioClip.d.ts +0 -12
- package/src/engine/sound/sopra/RandomContainerAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/RandomContainerAudioClip.js +0 -15
- package/src/engine/sound/sopra/SequenceContainerAudioClip.d.ts +0 -7
- package/src/engine/sound/sopra/SequenceContainerAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/SequenceContainerAudioClip.js +0 -8
- package/src/engine/sound/sopra/SilenceAudioClip.d.ts +0 -13
- package/src/engine/sound/sopra/SilenceAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/SilenceAudioClip.js +0 -15
- /package/src/{engine/graphics/sh3/path_tracer/sampling → core/geom/vec3}/v3_orthonormal_matrix_from_normal.d.ts +0 -0
|
@@ -35,6 +35,12 @@ export class Mantle extends Ability {
|
|
|
35
35
|
_endX: number;
|
|
36
36
|
_endY: number;
|
|
37
37
|
_endZ: number;
|
|
38
|
+
/** @private "mantle" = climb ONTO a standable top (lands grounded);
|
|
39
|
+
* "vault" = pull up and OVER a too-thin top (releases airborne on the
|
|
40
|
+
* far side). Chosen in onActivate from the ledge-pull-up request. */
|
|
41
|
+
private _kind;
|
|
42
|
+
/** @private Apex height of the vault hump. */
|
|
43
|
+
private _apexY;
|
|
38
44
|
canActivate(controller: any, runtime: any, sensors: any): boolean;
|
|
39
45
|
onActivate(controller: any, runtime: any): void;
|
|
40
46
|
canInterrupt(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mantle.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/control/first-person/abilities/Mantle.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Mantle.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/control/first-person/abilities/Mantle.js"],"names":[],"mappings":"AAiCA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;IAOQ,6CAA6C;IAC7C,WAAW;IACX,uCAAuC;IACvC,kBAAoB;IACpB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IACd,cAAc;IACd,cAAc;IACd;;0EAEsE;IACtE,cAAqB;IACrB,8CAA8C;IAC9C,eAAe;IAGnB,kEAgCC;IAED,gDAiEC;IAED,wBAGC;IAED,wFA0DC;IAED,oDAEC;CACJ;wBA3PuB,cAAc"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
1
2
|
import { FirstPersonPosture } from "../pose/FirstPersonPosture.js";
|
|
2
3
|
import { Ability } from "./Ability.js";
|
|
3
4
|
|
|
@@ -21,6 +22,15 @@ function easeOutCubic(t) {
|
|
|
21
22
|
return 1 - Math.pow(1 - t, 3);
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Back-loaded ease — gentle start, accelerating finish. Used for the
|
|
27
|
+
* DESCENDING half of a vault hump (you crest the edge then drop over).
|
|
28
|
+
* @param {number} t [0..1]
|
|
29
|
+
*/
|
|
30
|
+
function easeInCubic(t) {
|
|
31
|
+
return t * t * t;
|
|
32
|
+
}
|
|
33
|
+
|
|
24
34
|
/**
|
|
25
35
|
* Mantle ability — auto-triggers when the player walks/runs into a
|
|
26
36
|
* reachable obstacle with forward intent. The body follows a scripted
|
|
@@ -64,6 +74,12 @@ export class Mantle extends Ability {
|
|
|
64
74
|
this._endX = 0;
|
|
65
75
|
this._endY = 0;
|
|
66
76
|
this._endZ = 0;
|
|
77
|
+
/** @private "mantle" = climb ONTO a standable top (lands grounded);
|
|
78
|
+
* "vault" = pull up and OVER a too-thin top (releases airborne on the
|
|
79
|
+
* far side). Chosen in onActivate from the ledge-pull-up request. */
|
|
80
|
+
this._kind = "mantle";
|
|
81
|
+
/** @private Apex height of the vault hump. */
|
|
82
|
+
this._apexY = 0;
|
|
67
83
|
}
|
|
68
84
|
|
|
69
85
|
canActivate(controller, runtime, sensors) {
|
|
@@ -77,24 +93,25 @@ export class Mantle extends Ability {
|
|
|
77
93
|
if (!sensors.obstacleAhead.hit) return false;
|
|
78
94
|
if (!sensors.ledgeAhead.hit) return false;
|
|
79
95
|
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
//
|
|
92
|
-
//
|
|
96
|
+
// AUTO-mantle only onto a top we can STAND on — a thin knife-edge
|
|
97
|
+
// would leave the body overhanging and it'd fall off (on a wall-run
|
|
98
|
+
// wall, the reported snap-then-drop). A ledge-grab PULL-UP
|
|
99
|
+
// (`runtime.ledgePullUpRequest`) is allowed onto a thin top too: it
|
|
100
|
+
// VAULTS over instead of onto (see onActivate). Likewise the pull-up
|
|
101
|
+
// already expressed commitment, so it needn't re-assert forward intent.
|
|
102
|
+
const pullUp = runtime.ledgePullUpRequest;
|
|
103
|
+
if (!sensors.ledgeStandable && !pullUp) return false;
|
|
104
|
+
if (controller.intent.move.y < 0.1 && !pullUp) return false;
|
|
105
|
+
|
|
106
|
+
// Height check: the target surface must be within the reachable band.
|
|
107
|
+
// A pull-up starts from a full hang (~maxHeight below the lip), so give
|
|
108
|
+
// that path a slacker ceiling.
|
|
93
109
|
const surfaceTopY = sensors.ledgeAhead.point.y;
|
|
94
110
|
const playerFootY = controller.pose.rootPosition.y;
|
|
95
111
|
const heightDiff = surfaceTopY - playerFootY;
|
|
112
|
+
const maxH = pullUp ? cfg.pullUpMaxHeight : cfg.maxHeight;
|
|
96
113
|
if (heightDiff < cfg.minHeight) return false;
|
|
97
|
-
if (heightDiff >
|
|
114
|
+
if (heightDiff > maxH) return false;
|
|
98
115
|
|
|
99
116
|
return true;
|
|
100
117
|
}
|
|
@@ -112,15 +129,39 @@ export class Mantle extends Ability {
|
|
|
112
129
|
this._startY = startPos.y;
|
|
113
130
|
this._startZ = startPos.z;
|
|
114
131
|
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
// on the surface (not balancing on the edge).
|
|
132
|
+
// Climb ONTO a standable top, or VAULT OVER a too-thin one (a ledge
|
|
133
|
+
// pull-up onto a non-standable lip). Consume the one-shot request.
|
|
118
134
|
const yaw = runtime.bodyYaw;
|
|
119
135
|
const fx = Math.sin(yaw);
|
|
120
136
|
const fz = Math.cos(yaw);
|
|
121
|
-
|
|
122
|
-
this.
|
|
123
|
-
|
|
137
|
+
const ledge = sensors.ledgeAhead.point;
|
|
138
|
+
this._kind = (runtime.ledgePullUpRequest && !sensors.ledgeStandable) ? "vault" : "mantle";
|
|
139
|
+
runtime.ledgePullUpRequest = false;
|
|
140
|
+
if (this._kind === "vault") {
|
|
141
|
+
// Carry the body forward PAST the far edge; it crests an apex above
|
|
142
|
+
// the lip then drops over, releasing airborne on the far side.
|
|
143
|
+
this._endX = ledge.x + fx * cfg.vaultDistance;
|
|
144
|
+
this._endY = ledge.y;
|
|
145
|
+
this._endZ = ledge.z + fz * cfg.vaultDistance;
|
|
146
|
+
this._apexY = ledge.y + cfg.vaultApexClearance;
|
|
147
|
+
} else {
|
|
148
|
+
// Land ON TOP, displaced slightly forward of the edge so the body
|
|
149
|
+
// ends standing on the surface (not balancing on the lip).
|
|
150
|
+
this._endX = ledge.x + fx * cfg.forwardOffsetOnLand;
|
|
151
|
+
this._endY = ledge.y;
|
|
152
|
+
this._endZ = ledge.z + fz * cfg.forwardOffsetOnLand;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// -- Preconditions (dev-only; compiled out of prod). The scripted path
|
|
156
|
+
// interpolates toward this end every tick — a non-finite endpoint
|
|
157
|
+
// would drive the body (and camera) to NaN.
|
|
158
|
+
assert.ok(sensors.obstacleAhead.hit && sensors.ledgeAhead.hit,
|
|
159
|
+
"Mantle: activated without obstacle+ledge sensor hits");
|
|
160
|
+
assert.ok(
|
|
161
|
+
Number.isFinite(this._endX) && Number.isFinite(this._endY) && Number.isFinite(this._endZ)
|
|
162
|
+
&& Number.isFinite(this._apexY),
|
|
163
|
+
"Mantle: computed a non-finite end/apex position",
|
|
164
|
+
);
|
|
124
165
|
|
|
125
166
|
// Zero velocity — the body is on a path, not under integration.
|
|
126
167
|
runtime.velocityX = 0;
|
|
@@ -156,37 +197,55 @@ export class Mantle extends Ability {
|
|
|
156
197
|
// until release.
|
|
157
198
|
controller.state.posture = FirstPersonPosture.Stand;
|
|
158
199
|
|
|
200
|
+
const cfg = controller.config.mantle;
|
|
159
201
|
this._t += dt / this._duration;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
202
|
+
const t = this._t < 1 ? this._t : 1;
|
|
203
|
+
|
|
204
|
+
// Horizontal: ease-in-out lerp start→end (both kinds).
|
|
205
|
+
const horizT = easeInOutCubic(t);
|
|
206
|
+
const x = this._startX + (this._endX - this._startX) * horizT;
|
|
207
|
+
const z = this._startZ + (this._endZ - this._startZ) * horizT;
|
|
208
|
+
// Vertical: a CLIMB (ease-out up to the top) or a vault HUMP (rise to an
|
|
209
|
+
// apex above the lip, then drop over it on the back half).
|
|
210
|
+
let y;
|
|
211
|
+
if (this._kind === "vault") {
|
|
212
|
+
const tApex = 0.55;
|
|
213
|
+
y = t <= tApex
|
|
214
|
+
? this._startY + (this._apexY - this._startY) * easeOutCubic(t / tApex)
|
|
215
|
+
: this._apexY - cfg.vaultDropOnExit * easeInCubic((t - tApex) / (1 - tApex));
|
|
216
|
+
} else {
|
|
217
|
+
y = this._startY + (this._endY - this._startY) * easeOutCubic(t);
|
|
173
218
|
}
|
|
174
|
-
|
|
175
|
-
//
|
|
176
|
-
const horizT = easeInOutCubic(this._t);
|
|
177
|
-
const vertT = easeOutCubic(this._t);
|
|
178
|
-
bodyTransform.position.set(
|
|
179
|
-
this._startX + (this._endX - this._startX) * horizT,
|
|
180
|
-
this._startY + (this._endY - this._startY) * vertT,
|
|
181
|
-
this._startZ + (this._endZ - this._startZ) * horizT,
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
// Body is on a path — no integration this tick. Velocity stays 0.
|
|
219
|
+
bodyTransform.position.set(x, y, z);
|
|
220
|
+
// On the path — no integration; velocity stays 0 until release.
|
|
185
221
|
runtime.velocityX = 0;
|
|
186
222
|
runtime.velocityY = 0;
|
|
187
223
|
runtime.velocityZ = 0;
|
|
188
224
|
|
|
189
|
-
return true;
|
|
225
|
+
if (this._t < 1.0) return true;
|
|
226
|
+
|
|
227
|
+
// -- Completed --
|
|
228
|
+
if (this._kind === "vault") {
|
|
229
|
+
// Release AIRBORNE past the far edge: hand back forward + a little
|
|
230
|
+
// down so the body commits OVER. Base + the mover resolve the far
|
|
231
|
+
// side — ground catches it, or it falls into a gap (both are "over").
|
|
232
|
+
const yaw = runtime.bodyYaw;
|
|
233
|
+
runtime.velocityX = Math.sin(yaw) * cfg.vaultExitSpeed;
|
|
234
|
+
runtime.velocityZ = Math.cos(yaw) * cfg.vaultExitSpeed;
|
|
235
|
+
runtime.velocityY = -cfg.vaultExitDownSpeed;
|
|
236
|
+
controller.state.grounded = false;
|
|
237
|
+
controller.state.isAscending = false;
|
|
238
|
+
controller.signals.onLeaveGround.send1({ reason: "vault" });
|
|
239
|
+
controller.signals.onLedgeRelease.send1({ reason: "vault" });
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
// Mantle: landed on top.
|
|
243
|
+
controller.state.grounded = true;
|
|
244
|
+
controller.state.verticalSpeed = 0;
|
|
245
|
+
controller.state.airborneTime = 0;
|
|
246
|
+
controller.state.timeSinceGrounded = 0;
|
|
247
|
+
controller.signals.onLand.send1({ verticalSpeed: 0, kind: "soft" });
|
|
248
|
+
return false;
|
|
190
249
|
}
|
|
191
250
|
|
|
192
251
|
onDeactivate(_controller, _runtime) {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scramble-up ability — a short vertical wall-run up a wall the player JUMPS
|
|
3
|
+
* at while facing it, à la Assassin's Creed. A deliberate jump (not just
|
|
4
|
+
* walking into the wall) launches a brief upward climb; a running start gives
|
|
5
|
+
* higher purchase, so the player can reach a high ledge to grab, or kick off.
|
|
6
|
+
*
|
|
7
|
+
* Activation:
|
|
8
|
+
* - A fresh JUMP press (rising edge). A scramble is a deliberate jump at the
|
|
9
|
+
* wall — and the edge means it can't auto-loop scramble→fall→land→scramble:
|
|
10
|
+
* each one needs its own press.
|
|
11
|
+
* - Grounded — a ground-initiated move: run or stand AT the wall and jump.
|
|
12
|
+
* - `sensors.wallFront.hit` + `!sensors.ledgeAhead.hit` — facing a wall whose
|
|
13
|
+
* top is OUT of mantle/grab reach (a reachable top is Mantle's job; this
|
|
14
|
+
* makes the two mutually exclusive).
|
|
15
|
+
* - Forward intent (`intent.move.y > 0.5`) — committed into the wall, so a
|
|
16
|
+
* plain jump near a wall (no forward) is still just a jump.
|
|
17
|
+
*
|
|
18
|
+
* Behaviour:
|
|
19
|
+
* - Launches upward off a physical PUSH-OFF FORCE: `baseJumpForce` + the
|
|
20
|
+
* horizontal approach speed × `momentumForcePerSpeed` (capped at
|
|
21
|
+
* `maxJumpForce`), converted to a launch velocity through the body's mass +
|
|
22
|
+
* push-off distance (see {@link jumpDynamics}). A running start climbs high,
|
|
23
|
+
* a standstill gives a small hop, and a heavier character scrambles lower
|
|
24
|
+
* for the same force — just like a jump. Horizontal velocity is replaced by
|
|
25
|
+
* a small into-wall "hug" so the body climbs the face (the mover clips the
|
|
26
|
+
* penetration). The climb DECELERATES (`decel`): a short burst, roughly
|
|
27
|
+
* `launchVy²/(2·decel)` m high over `launchVy/decel` s.
|
|
28
|
+
* - Motion routes through the shared mover, so the climb is collision-checked
|
|
29
|
+
* and the ledge sensors update as the body rises.
|
|
30
|
+
*
|
|
31
|
+
* Exit:
|
|
32
|
+
* - Apex (`velocityY <= 0`) → release. If a ledge is now within reach,
|
|
33
|
+
* LedgeGrab (which needs a descent) catches on the way down; otherwise the
|
|
34
|
+
* player falls back.
|
|
35
|
+
* - A SECOND jump press (released then re-pressed during the climb) → WALL-
|
|
36
|
+
* KICK off the front wall: impulse out along the normal, plus an upward
|
|
37
|
+
* launch off the body's full jump push-off force (`runtime.jumpForce`) — so
|
|
38
|
+
* the kick rises like a max-height jump. The front-wall counterpart of
|
|
39
|
+
* wall-run → wall-jump.
|
|
40
|
+
* - Lost the wall (`!wallFront.hit`) → reached the top (or it ended); release.
|
|
41
|
+
* - Timer (`maxDuration`) or re-grounded → release.
|
|
42
|
+
*
|
|
43
|
+
* Priority 55 — above wall-run (50, an ALONG-wall move) and below wall-jump
|
|
44
|
+
* (60). It hands off to LedgeGrab (40) via the apex→descent.
|
|
45
|
+
*
|
|
46
|
+
* @author Alex Goldring
|
|
47
|
+
* @copyright Company Named Limited (c) 2026
|
|
48
|
+
*/
|
|
49
|
+
export class ScrambleUp extends Ability {
|
|
50
|
+
/** @private Captured wall outward normal (x,z) — for the hug + the kick. */
|
|
51
|
+
private _nx;
|
|
52
|
+
_nz: number;
|
|
53
|
+
/** @private Seconds since activation. */
|
|
54
|
+
private _elapsed;
|
|
55
|
+
canActivate(controller: any, runtime: any, sensors: any): boolean;
|
|
56
|
+
onActivate(controller: any, runtime: any): void;
|
|
57
|
+
canInterrupt(): boolean;
|
|
58
|
+
tick(controller: any, runtime: any, bodyTransform: any, dt: any, system: any): boolean;
|
|
59
|
+
}
|
|
60
|
+
import { Ability } from "./Ability.js";
|
|
61
|
+
//# sourceMappingURL=ScrambleUp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrambleUp.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/control/first-person/abilities/ScrambleUp.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH;IAMQ,4EAA4E;IAC5E,YAAY;IACZ,YAAY;IACZ,yCAAyC;IACzC,iBAAiB;IAGrB,kEAiBC;IAED,gDAgCC;IAED,wBAIC;IAED,uFAwDC;CACJ;wBAnLuB,cAAc"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { launchVelocityForForce } from "../math/jumpDynamics.js";
|
|
2
|
+
import { FirstPersonPosture } from "../pose/FirstPersonPosture.js";
|
|
3
|
+
import { Ability } from "./Ability.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Scramble-up ability — a short vertical wall-run up a wall the player JUMPS
|
|
7
|
+
* at while facing it, à la Assassin's Creed. A deliberate jump (not just
|
|
8
|
+
* walking into the wall) launches a brief upward climb; a running start gives
|
|
9
|
+
* higher purchase, so the player can reach a high ledge to grab, or kick off.
|
|
10
|
+
*
|
|
11
|
+
* Activation:
|
|
12
|
+
* - A fresh JUMP press (rising edge). A scramble is a deliberate jump at the
|
|
13
|
+
* wall — and the edge means it can't auto-loop scramble→fall→land→scramble:
|
|
14
|
+
* each one needs its own press.
|
|
15
|
+
* - Grounded — a ground-initiated move: run or stand AT the wall and jump.
|
|
16
|
+
* - `sensors.wallFront.hit` + `!sensors.ledgeAhead.hit` — facing a wall whose
|
|
17
|
+
* top is OUT of mantle/grab reach (a reachable top is Mantle's job; this
|
|
18
|
+
* makes the two mutually exclusive).
|
|
19
|
+
* - Forward intent (`intent.move.y > 0.5`) — committed into the wall, so a
|
|
20
|
+
* plain jump near a wall (no forward) is still just a jump.
|
|
21
|
+
*
|
|
22
|
+
* Behaviour:
|
|
23
|
+
* - Launches upward off a physical PUSH-OFF FORCE: `baseJumpForce` + the
|
|
24
|
+
* horizontal approach speed × `momentumForcePerSpeed` (capped at
|
|
25
|
+
* `maxJumpForce`), converted to a launch velocity through the body's mass +
|
|
26
|
+
* push-off distance (see {@link jumpDynamics}). A running start climbs high,
|
|
27
|
+
* a standstill gives a small hop, and a heavier character scrambles lower
|
|
28
|
+
* for the same force — just like a jump. Horizontal velocity is replaced by
|
|
29
|
+
* a small into-wall "hug" so the body climbs the face (the mover clips the
|
|
30
|
+
* penetration). The climb DECELERATES (`decel`): a short burst, roughly
|
|
31
|
+
* `launchVy²/(2·decel)` m high over `launchVy/decel` s.
|
|
32
|
+
* - Motion routes through the shared mover, so the climb is collision-checked
|
|
33
|
+
* and the ledge sensors update as the body rises.
|
|
34
|
+
*
|
|
35
|
+
* Exit:
|
|
36
|
+
* - Apex (`velocityY <= 0`) → release. If a ledge is now within reach,
|
|
37
|
+
* LedgeGrab (which needs a descent) catches on the way down; otherwise the
|
|
38
|
+
* player falls back.
|
|
39
|
+
* - A SECOND jump press (released then re-pressed during the climb) → WALL-
|
|
40
|
+
* KICK off the front wall: impulse out along the normal, plus an upward
|
|
41
|
+
* launch off the body's full jump push-off force (`runtime.jumpForce`) — so
|
|
42
|
+
* the kick rises like a max-height jump. The front-wall counterpart of
|
|
43
|
+
* wall-run → wall-jump.
|
|
44
|
+
* - Lost the wall (`!wallFront.hit`) → reached the top (or it ended); release.
|
|
45
|
+
* - Timer (`maxDuration`) or re-grounded → release.
|
|
46
|
+
*
|
|
47
|
+
* Priority 55 — above wall-run (50, an ALONG-wall move) and below wall-jump
|
|
48
|
+
* (60). It hands off to LedgeGrab (40) via the apex→descent.
|
|
49
|
+
*
|
|
50
|
+
* @author Alex Goldring
|
|
51
|
+
* @copyright Company Named Limited (c) 2026
|
|
52
|
+
*/
|
|
53
|
+
export class ScrambleUp extends Ability {
|
|
54
|
+
constructor() {
|
|
55
|
+
super();
|
|
56
|
+
this.name = "ScrambleUp";
|
|
57
|
+
this.priority = 55;
|
|
58
|
+
|
|
59
|
+
/** @private Captured wall outward normal (x,z) — for the hug + the kick. */
|
|
60
|
+
this._nx = 0;
|
|
61
|
+
this._nz = 0;
|
|
62
|
+
/** @private Seconds since activation. */
|
|
63
|
+
this._elapsed = 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
canActivate(controller, runtime, sensors) {
|
|
67
|
+
const cfg = controller.config.scrambleUp;
|
|
68
|
+
if (!cfg) return false;
|
|
69
|
+
if (sensors === undefined || sensors === null) return false;
|
|
70
|
+
|
|
71
|
+
// A deliberate JUMP at the wall starts a scramble — walking into it is
|
|
72
|
+
// not enough. The fresh-press edge is also what prevents an automatic
|
|
73
|
+
// scramble→fall→land→scramble loop: each one needs its own press.
|
|
74
|
+
if (!controller.intent.jump || runtime.prevJumpHeld) return false;
|
|
75
|
+
// Ground-initiated: run or stand AT the wall and jump.
|
|
76
|
+
if (!controller.state.grounded) return false;
|
|
77
|
+
// Facing a wall whose top is out of reach, committed forward into it.
|
|
78
|
+
if (!sensors.wallFront.hit) return false;
|
|
79
|
+
if (sensors.ledgeAhead.hit) return false;
|
|
80
|
+
if (controller.intent.move.y <= 0.5) return false;
|
|
81
|
+
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
onActivate(controller, runtime) {
|
|
86
|
+
const cfg = controller.config.scrambleUp;
|
|
87
|
+
const sensors = runtime.sensors;
|
|
88
|
+
this._elapsed = 0;
|
|
89
|
+
this._nx = sensors.wallFront.normal.x;
|
|
90
|
+
this._nz = sensors.wallFront.normal.z;
|
|
91
|
+
|
|
92
|
+
// Reward forward momentum: the leg PUSH-OFF FORCE scales with the
|
|
93
|
+
// horizontal approach speed at the jump — a standstill gives the base
|
|
94
|
+
// force, a full sprint run-up the capped maximum. The force becomes a
|
|
95
|
+
// launch velocity through the body's mass + push-off distance, so a
|
|
96
|
+
// heavier character scrambles lower for the same effort (like a jump).
|
|
97
|
+
const body = controller.config.body;
|
|
98
|
+
const approach = Math.hypot(runtime.velocityX, runtime.velocityZ);
|
|
99
|
+
const force = Math.min(cfg.baseJumpForce + approach * cfg.momentumForcePerSpeed, cfg.maxJumpForce);
|
|
100
|
+
const launchVy = launchVelocityForForce(force, body.mass, body.jumpPushoffDistance);
|
|
101
|
+
|
|
102
|
+
runtime.velocityY = launchVy;
|
|
103
|
+
runtime.velocityX = -this._nx * cfg.hugSpeed;
|
|
104
|
+
runtime.velocityZ = -this._nz * cfg.hugSpeed;
|
|
105
|
+
|
|
106
|
+
// Climbing — airborne; clear any in-progress jump state.
|
|
107
|
+
controller.state.grounded = false;
|
|
108
|
+
runtime.midJump = false;
|
|
109
|
+
runtime.apexFired = false;
|
|
110
|
+
controller.state.isVariableJumpCut = false;
|
|
111
|
+
controller.state.isAscending = true;
|
|
112
|
+
// Consume the launch press so the first tick's wall-kick edge doesn't
|
|
113
|
+
// fire on it — the kick is a SEPARATE press during the climb.
|
|
114
|
+
runtime.prevJumpHeld = true;
|
|
115
|
+
|
|
116
|
+
controller.signals.onLeaveGround.send1({ reason: "scramble" });
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
canInterrupt() {
|
|
120
|
+
// Wall-jump (60) is the only higher-priority ability; the scramble's own
|
|
121
|
+
// jump-kick consumes the press first, so a preempt never lands.
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
tick(controller, runtime, bodyTransform, dt, system) {
|
|
126
|
+
const cfg = controller.config.scrambleUp;
|
|
127
|
+
const sensors = runtime.sensors;
|
|
128
|
+
const intent = controller.intent;
|
|
129
|
+
this._elapsed += dt;
|
|
130
|
+
|
|
131
|
+
// Climbing upright; body pinned to the wall — no lean.
|
|
132
|
+
controller.state.posture = FirstPersonPosture.Stand;
|
|
133
|
+
runtime.leanTargetRad = 0;
|
|
134
|
+
|
|
135
|
+
// -- Exit: timer (safety; the apex normally releases first).
|
|
136
|
+
if (this._elapsed >= cfg.maxDuration) return false;
|
|
137
|
+
|
|
138
|
+
// -- Exit: a FRESH jump press (released then re-pressed since the launch)
|
|
139
|
+
// → WALL-KICK off the front wall (out along the normal + up).
|
|
140
|
+
if (intent.jump && !runtime.prevJumpHeld) {
|
|
141
|
+
const body = controller.config.body;
|
|
142
|
+
runtime.velocityX += this._nx * cfg.kickOutwardImpulse;
|
|
143
|
+
runtime.velocityZ += this._nz * cfg.kickOutwardImpulse;
|
|
144
|
+
// Up off the wall with the SAME push-off force as a max-height jump
|
|
145
|
+
// (runtime.jumpForce), converted through this body — so the kick's
|
|
146
|
+
// vertical launch equals a full jump's, not a reduced fraction.
|
|
147
|
+
runtime.velocityY = launchVelocityForForce(runtime.jumpForce, body.mass, body.jumpPushoffDistance);
|
|
148
|
+
runtime.prevJumpHeld = true;
|
|
149
|
+
runtime.midJump = true;
|
|
150
|
+
controller.state.isVariableJumpCut = false;
|
|
151
|
+
controller.state.isAscending = true;
|
|
152
|
+
controller.signals.onJumpStart.send1({ peakHeight: controller.config.jump.peakHeight });
|
|
153
|
+
controller.signals.onLeaveGround.send1({ reason: "scramble-kick" });
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
// Track the jump button so a release→re-press reads as a fresh edge next
|
|
157
|
+
// tick (base, which normally owns this, isn't running while we do).
|
|
158
|
+
runtime.prevJumpHeld = intent.jump;
|
|
159
|
+
|
|
160
|
+
// -- Exit: lost the wall — reached the top (or it ended).
|
|
161
|
+
if (!sensors.wallFront.hit) return false;
|
|
162
|
+
|
|
163
|
+
// -- Decelerate the climb; release at the apex. On the way down LedgeGrab
|
|
164
|
+
// catches if a ledge is now in reach, else the player falls back.
|
|
165
|
+
runtime.velocityY -= cfg.decel * dt;
|
|
166
|
+
if (runtime.velocityY <= 0) return false;
|
|
167
|
+
|
|
168
|
+
// Hug the wall while climbing (re-assert each tick; the mover clips it).
|
|
169
|
+
runtime.velocityX = -this._nx * cfg.hugSpeed;
|
|
170
|
+
runtime.velocityZ = -this._nz * cfg.hugSpeed;
|
|
171
|
+
|
|
172
|
+
// Resolve the climb through the shared mover (sweep-and-slide + ground/
|
|
173
|
+
// ledge categorize). Gravity is NOT re-applied — the scramble owns the
|
|
174
|
+
// vertical model, like wall-run.
|
|
175
|
+
system._resolveMotion(controller, runtime, bodyTransform, dt);
|
|
176
|
+
|
|
177
|
+
// -- Exit: the mover caught a floor (shouldn't happen rising, but safe).
|
|
178
|
+
if (controller.state.grounded) return false;
|
|
179
|
+
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jump power as physics, not a magic velocity.
|
|
3
|
+
*
|
|
4
|
+
* A jump is the legs doing WORK: a push-off force `F` (newtons) applied over a
|
|
5
|
+
* leg-extension distance `d` (meters) while the body is still on the ground.
|
|
6
|
+
* That work becomes the body's kinetic energy at the instant it leaves the
|
|
7
|
+
* ground, which gravity then trades back for height:
|
|
8
|
+
*
|
|
9
|
+
* F · d = ½ · m · v₀² (leg work → launch kinetic energy)
|
|
10
|
+
* ½ · m · v₀² = m · g · h (launch KE → potential energy at apex)
|
|
11
|
+
*
|
|
12
|
+
* Eliminating v₀ collapses the two into a single, mass-honest relationship
|
|
13
|
+
* between the force the legs deliver and the apex the body reaches:
|
|
14
|
+
*
|
|
15
|
+
* h = F · d / (m · g)
|
|
16
|
+
* F = m · g · h / d
|
|
17
|
+
* v₀ = √(2 · F · d / m) = √(2 · g · h)
|
|
18
|
+
*
|
|
19
|
+
* Why express jump power as a FORCE (newtons) rather than a launch velocity?
|
|
20
|
+
* - It is a property of the CHARACTER (the legs), not of the jump. A fixed
|
|
21
|
+
* leg force makes a heavier body jump lower — `h ∝ 1/m` — for free, which a
|
|
22
|
+
* raw launch-velocity number cannot express (the same v₀ ignores mass).
|
|
23
|
+
* - It composes: momentum, fatigue, and surface bonuses all add/scale in the
|
|
24
|
+
* same physical currency (newtons) before a single conversion to velocity.
|
|
25
|
+
*
|
|
26
|
+
* `d` (the push-off distance) is the one extra parameter a newtons model needs:
|
|
27
|
+
* force alone can't determine a launch without the distance (or time) it acts
|
|
28
|
+
* over. It is a body constant — roughly the crouch-to-full-extension travel of
|
|
29
|
+
* the legs (~0.4–0.5 m for a ~1.8 m human countermovement jump).
|
|
30
|
+
*
|
|
31
|
+
* All three functions are pure and frame-independent. The headline is
|
|
32
|
+
* {@link jumpForceForHeight}: the newtons a designer needs to reach a desired
|
|
33
|
+
* apex on a given character. {@link launchVelocityForForce} is the forward
|
|
34
|
+
* conversion an ability applies at launch.
|
|
35
|
+
*
|
|
36
|
+
* @author Alex Goldring
|
|
37
|
+
* @copyright Company Named Limited (c) 2026
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* The push-off force (newtons) the legs must deliver for the body to reach a
|
|
41
|
+
* given apex height — i.e. newtons BACK-CALCULATED from the desired maximum
|
|
42
|
+
* jump height on this character.
|
|
43
|
+
*
|
|
44
|
+
* F = m · g · h / d
|
|
45
|
+
*
|
|
46
|
+
* Heavier body → more force for the same height; stronger gravity → more force;
|
|
47
|
+
* a longer push-off distance → less force (the work is spread over more travel).
|
|
48
|
+
*
|
|
49
|
+
* @param {number} mass body mass, kg (> 0)
|
|
50
|
+
* @param {number} gravity gravitational acceleration, m/s² (> 0)
|
|
51
|
+
* @param {number} pushoffDistance leg push-off distance, m (> 0)
|
|
52
|
+
* @param {number} height desired apex height above launch, m (>= 0)
|
|
53
|
+
* @returns {number} push-off force in newtons
|
|
54
|
+
*/
|
|
55
|
+
export function jumpForceForHeight(mass: number, gravity: number, pushoffDistance: number, height: number): number;
|
|
56
|
+
/**
|
|
57
|
+
* The apex height (meters) a given push-off force produces on this character —
|
|
58
|
+
* the inverse of {@link jumpForceForHeight}.
|
|
59
|
+
*
|
|
60
|
+
* h = F · d / (m · g)
|
|
61
|
+
*
|
|
62
|
+
* @param {number} force push-off force, newtons (>= 0)
|
|
63
|
+
* @param {number} mass body mass, kg (> 0)
|
|
64
|
+
* @param {number} gravity gravitational acceleration, m/s² (> 0)
|
|
65
|
+
* @param {number} pushoffDistance leg push-off distance, m (> 0)
|
|
66
|
+
* @returns {number} apex height above launch, meters
|
|
67
|
+
*/
|
|
68
|
+
export function jumpHeightForForce(force: number, mass: number, gravity: number, pushoffDistance: number): number;
|
|
69
|
+
/**
|
|
70
|
+
* The launch velocity (m/s) a given push-off force imparts to this character —
|
|
71
|
+
* the forward conversion an ability applies at the instant of launch.
|
|
72
|
+
*
|
|
73
|
+
* v₀ = √(2 · F · d / m)
|
|
74
|
+
*
|
|
75
|
+
* Note this is independent of gravity: gravity only governs the apex the launch
|
|
76
|
+
* velocity then reaches, not the launch itself.
|
|
77
|
+
*
|
|
78
|
+
* @param {number} force push-off force, newtons (>= 0)
|
|
79
|
+
* @param {number} mass body mass, kg (> 0)
|
|
80
|
+
* @param {number} pushoffDistance leg push-off distance, m (> 0)
|
|
81
|
+
* @returns {number} launch velocity, m/s
|
|
82
|
+
*/
|
|
83
|
+
export function launchVelocityForForce(force: number, mass: number, pushoffDistance: number): number;
|
|
84
|
+
//# sourceMappingURL=jumpDynamics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jumpDynamics.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/control/first-person/math/jumpDynamics.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,yCANW,MAAM,WACN,MAAM,mBACN,MAAM,UACN,MAAM,GACJ,MAAM,CASlB;AAED;;;;;;;;;;;GAWG;AACH,0CANW,MAAM,QACN,MAAM,WACN,MAAM,mBACN,MAAM,GACJ,MAAM,CASlB;AAED;;;;;;;;;;;;;GAaG;AACH,8CALW,MAAM,QACN,MAAM,mBACN,MAAM,GACJ,MAAM,CAQlB"}
|