@series-inc/rundot-syncplay 6.0.0-rc.2 → 6.0.0-rc.21
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 +133 -0
- package/core/deterministic-math.d.ts +75 -1
- package/core/native/instance_ledger.hpp +1095 -0
- package/core/native/legacy_checkpoint_ids.hpp +107 -0
- package/core/native/physics/abi.cpp +39 -211
- package/core/native/physics/abi.hpp +2 -6
- package/core/native/physics/articulation.cpp +1434 -0
- package/core/native/physics/articulation.hpp +279 -0
- package/core/native/physics/buoyancy.cpp +1588 -0
- package/core/native/physics/buoyancy.hpp +254 -0
- package/core/native/physics/capsule_triangle.cpp +168 -0
- package/core/native/physics/capsule_triangle.hpp +40 -0
- package/core/native/physics/capsule_triangle_native.inc +291 -0
- package/core/native/physics/certified_sum.hpp +218 -0
- package/core/native/physics/character.cpp +638 -0
- package/core/native/physics/character.hpp +169 -0
- package/core/native/physics/checkpoint_schema.hpp +379 -0
- package/core/native/physics/cloth.cpp +1401 -0
- package/core/native/physics/cloth.hpp +357 -0
- package/core/native/physics/constraint_rows.cpp +363 -2
- package/core/native/physics/constraint_rows.hpp +72 -1
- package/core/native/physics/deformable_query.cpp +1630 -0
- package/core/native/physics/deformable_query.hpp +578 -0
- package/core/native/physics/distance.cpp +1166 -0
- package/core/native/physics/distance.hpp +151 -0
- package/core/native/physics/exact/exact-applied.cpp +101 -0
- package/core/native/physics/exact/exact-applied.hpp +112 -0
- package/core/native/physics/exact/exact-dyadic.cpp +691 -0
- package/core/native/physics/exact/exact-dyadic.hpp +58 -0
- package/core/native/physics/exact/exact-operation.hpp +51 -0
- package/core/native/physics/exact/word-core.hpp +262 -0
- package/core/native/physics/extended_abi.cpp +1242 -0
- package/core/native/physics/extended_abi.hpp +355 -0
- package/core/native/physics/extended_abi_characters.cpp +261 -0
- package/core/native/physics/extended_abi_characters.hpp +434 -0
- package/core/native/physics/extended_abi_core_features.cpp +713 -0
- package/core/native/physics/extended_abi_core_features.hpp +226 -0
- package/core/native/physics/extended_abi_deformables.cpp +448 -0
- package/core/native/physics/extended_abi_deformables.hpp +867 -0
- package/core/native/physics/extended_abi_vehicles.cpp +411 -0
- package/core/native/physics/extended_abi_vehicles.hpp +222 -0
- package/core/native/physics/fracture.cpp +1981 -0
- package/core/native/physics/fracture.hpp +460 -0
- package/core/native/physics/gear.cpp +563 -0
- package/core/native/physics/gear.hpp +158 -0
- package/core/native/physics/geometry_memory.hpp +476 -0
- package/core/native/physics/geometry_store.cpp +547 -0
- package/core/native/physics/geometry_store.hpp +134 -0
- package/core/native/physics/lag_compensation.cpp +1626 -0
- package/core/native/physics/lag_compensation.hpp +405 -0
- package/core/native/physics/mass_properties.cpp +449 -0
- package/core/native/physics/mass_properties.hpp +23 -0
- package/core/native/physics/material_pose.hpp +988 -0
- package/core/native/physics/particles.cpp +1065 -0
- package/core/native/physics/particles.hpp +261 -0
- package/core/native/physics/path_joint.cpp +781 -0
- package/core/native/physics/path_joint.hpp +154 -0
- package/core/native/physics/physics.cpp +13043 -1065
- package/core/native/physics/physics.hpp +184 -8
- package/core/native/physics/planar_deformable.cpp +2433 -0
- package/core/native/physics/planar_deformable.hpp +889 -0
- package/core/native/physics/platformer_2d.cpp +1353 -0
- package/core/native/physics/platformer_2d.hpp +340 -0
- package/core/native/physics/powered_ragdoll.cpp +1100 -0
- package/core/native/physics/powered_ragdoll.hpp +279 -0
- package/core/native/physics/powertrain.cpp +586 -0
- package/core/native/physics/powertrain.hpp +180 -0
- package/core/native/physics/pulley.cpp +311 -0
- package/core/native/physics/pulley.hpp +121 -0
- package/core/native/physics/ragdoll.cpp +586 -0
- package/core/native/physics/ragdoll.hpp +221 -0
- package/core/native/physics/rope.cpp +692 -0
- package/core/native/physics/rope.hpp +215 -0
- package/core/native/physics/rounded_convex.cpp +1229 -0
- package/core/native/physics/rounded_convex.hpp +287 -0
- package/core/native/physics/sdf_geometry.cpp +1821 -0
- package/core/native/physics/sdf_geometry.hpp +474 -0
- package/core/native/physics/soft_body.cpp +1449 -0
- package/core/native/physics/soft_body.hpp +328 -0
- package/core/native/physics/soft_collision.cpp +1862 -0
- package/core/native/physics/soft_collision.hpp +561 -0
- package/core/native/physics/surface_velocity.cpp +366 -0
- package/core/native/physics/surface_velocity.hpp +243 -0
- package/core/native/physics/topology.cpp +357 -39
- package/core/native/physics/topology.hpp +97 -6
- package/core/native/physics/tracks.cpp +1179 -0
- package/core/native/physics/tracks.hpp +404 -0
- package/core/native/physics/vehicle.cpp +629 -0
- package/core/native/physics/vehicle.hpp +191 -0
- package/core/native/physics/voxel_cooking.cpp +1929 -0
- package/core/native/physics/voxel_cooking.hpp +395 -0
- package/core/native/physics/world.cpp +5290 -854
- package/core/native/physics/world.hpp +796 -24
- package/core/native/physics/world_abi.cpp +3840 -306
- package/core/native/physics/world_abi.hpp +530 -10
- package/core/native/physics/world_digest_visitor.hpp +277 -0
- package/core/native/physics/world_strong_digest.hpp +557 -0
- package/core/native/physics2d/ccd.cpp +1302 -0
- package/core/native/physics2d/ccd.hpp +141 -0
- package/core/native/physics2d/checkpoint_memory.hpp +349 -0
- package/core/native/physics2d/clock_primitives.hpp +138 -0
- package/core/native/physics2d/commands.cpp +174 -28
- package/core/native/physics2d/commands.hpp +3 -1
- package/core/native/physics2d/compound.cpp +581 -0
- package/core/native/physics2d/compound.hpp +248 -0
- package/core/native/physics2d/contour.cpp +325 -0
- package/core/native/physics2d/contour.hpp +143 -0
- package/core/native/physics2d/frame_scope.hpp +124 -0
- package/core/native/physics2d/joint_phases.hpp +93 -0
- package/core/native/physics2d/joints.cpp +587 -150
- package/core/native/physics2d/joints.hpp +5 -0
- package/core/native/physics2d/memory_private.hpp +125 -0
- package/core/native/physics2d/owned_abi.cpp +1354 -879
- package/core/native/physics2d/owned_abi.hpp +190 -52
- package/core/native/physics2d/phase_test_hooks.hpp +17 -0
- package/core/native/physics2d/physics2d.cpp +2073 -120
- package/core/native/physics2d/physics2d.hpp +154 -2
- package/core/native/physics2d/queries.cpp +1055 -79
- package/core/native/physics2d/queries.hpp +71 -5
- package/core/native/physics2d/world.cpp +1313 -353
- package/core/native/physics2d/world.hpp +124 -13
- package/core/native/sha256/sha256_compress_unsigned.hpp +68 -0
- package/core/native/sha256/sha256_fips_constants.hpp +24 -0
- package/core/native/sha256/sha256_length.hpp +56 -0
- package/core/native/sha256/sha256_memo.hpp +48 -0
- package/core/native/sha256/sha256_sink.hpp +234 -0
- package/core/physics2d-owned.d.ts +466 -126
- package/core/runtime.d.ts +192 -19
- package/core/scripts/build-native.mjs +34 -0
- package/core/scripts/build-wasm-physics.mjs +272 -23
- package/core/scripts/extended-physics-profile.mjs +634 -0
- package/core/scripts/generate-physics2d-vectors.mjs +59 -0
- package/core/src/kinetix-deterministic-math.d.ts +2 -0
- package/core/src/kinetix-deterministic-math.mjs +513 -27
- package/core/src/kinetix-owned-runtime-adapter.mjs +788 -0
- package/core/src/kinetix-runtime-adapter-utils.mjs +54 -6
- package/core/src/kinetix-runtime-contract.mjs +55 -9
- package/core/src/kinetix-runtime-identity.mjs +12 -1
- package/core/src/kinetix-session-config.mjs +7 -2
- package/core/src/kinetix-state-report.mjs +36 -0
- package/core/src/physics/abi-constants.mjs +5 -4
- package/core/src/physics/articulation.d.mts +194 -0
- package/core/src/physics/articulation.mjs +1141 -0
- package/core/src/physics/buoyancy.d.mts +143 -0
- package/core/src/physics/buoyancy.mjs +268 -0
- package/core/src/physics/cloth.d.mts +314 -0
- package/core/src/physics/cloth.mjs +1156 -0
- package/core/src/physics/deformable-query.d.mts +217 -0
- package/core/src/physics/deformable-query.mjs +1412 -0
- package/core/src/physics/distance.d.mts +160 -0
- package/core/src/physics/distance.mjs +175 -0
- package/core/src/physics/extended-wasm-instance.d.mts +5 -0
- package/core/src/physics/extended-wasm-instance.mjs +48 -0
- package/core/src/physics/feature-api.d.mts +74 -0
- package/core/src/physics/feature-api.mjs +98 -0
- package/core/src/physics/fracture.d.mts +133 -0
- package/core/src/physics/fracture.mjs +1324 -0
- package/core/src/physics/gear.d.mts +585 -0
- package/core/src/physics/gear.mjs +955 -0
- package/core/src/physics/lag-compensation.d.mts +101 -0
- package/core/src/physics/lag-compensation.mjs +1100 -0
- package/core/src/physics/mass-properties.d.mts +114 -0
- package/core/src/physics/mass-properties.mjs +137 -468
- package/core/src/physics/particles.d.mts +177 -0
- package/core/src/physics/particles.mjs +758 -0
- package/core/src/physics/path-joint.d.mts +171 -0
- package/core/src/physics/path-joint.mjs +1231 -0
- package/core/src/physics/physics-extended-wasm-module.generated.mjs +13 -0
- package/core/src/physics/physics-profile-wasm-module.generated.mjs +48 -0
- package/core/src/physics/physics-wasm-module.generated.mjs +34 -5
- package/core/src/physics/powered-ragdoll.d.mts +188 -0
- package/core/src/physics/powered-ragdoll.mjs +1043 -0
- package/core/src/physics/powertrain.d.mts +260 -0
- package/core/src/physics/powertrain.mjs +621 -0
- package/core/src/physics/pulley.d.mts +98 -0
- package/core/src/physics/pulley.mjs +686 -0
- package/core/src/physics/ragdoll.d.mts +289 -0
- package/core/src/physics/ragdoll.mjs +1323 -0
- package/core/src/physics/rope.d.mts +241 -0
- package/core/src/physics/rope.mjs +319 -0
- package/core/src/physics/rounded-convex.d.mts +328 -0
- package/core/src/physics/rounded-convex.mjs +1404 -0
- package/core/src/physics/sdf-geometry.d.mts +117 -0
- package/core/src/physics/sdf-geometry.mjs +1204 -0
- package/core/src/physics/soft-body.d.mts +144 -0
- package/core/src/physics/soft-body.mjs +1285 -0
- package/core/src/physics/soft-collision.d.mts +651 -0
- package/core/src/physics/soft-collision.mjs +1883 -0
- package/core/src/physics/surface-velocity.d.mts +156 -0
- package/core/src/physics/surface-velocity.mjs +722 -0
- package/core/src/physics/tracks.d.mts +411 -0
- package/core/src/physics/tracks.mjs +1074 -0
- package/core/src/physics/vehicle.d.mts +3 -0
- package/core/src/physics/vehicle.mjs +172 -0
- package/core/src/physics/voxel-cooking.d.mts +219 -0
- package/core/src/physics/voxel-cooking.mjs +1499 -0
- package/core/src/physics/voxel-swept-quad.mjs +110 -0
- package/core/src/physics/wasm-instance.mjs +160 -23
- package/core/src/physics/world.d.mts +62 -0
- package/core/src/physics/world.mjs +1947 -152
- package/core/src/physics2d/body-state.mjs +218 -15
- package/core/src/physics2d/collision.d.mts +52 -0
- package/core/src/physics2d/collision.mjs +234 -0
- package/core/src/physics2d/compound.mjs +454 -0
- package/core/src/physics2d/contour-state.mjs +771 -0
- package/core/src/physics2d/feature-api.d.mts +211 -0
- package/core/src/physics2d/feature-api.mjs +3 -0
- package/core/src/physics2d/fluid-state.mjs +145 -0
- package/core/src/physics2d/joint-state.mjs +1 -1
- package/core/src/physics2d/owned-queries.mjs +3 -1
- package/core/src/physics2d/owned-transport.mjs +268 -122
- package/core/src/physics2d/owned-world.mjs +353 -230
- package/core/src/physics2d/particle-fluid.d.mts +152 -0
- package/core/src/physics2d/particle-fluid.mjs +233 -0
- package/core/src/physics2d/physics2d-wasm-module.generated.mjs +27 -10
- package/core/src/physics2d/query-codec.mjs +61 -13
- package/core/src/physics2d/submerged-geometry.d.mts +51 -0
- package/core/src/physics2d/submerged-geometry.mjs +186 -0
- package/core/src/runtime.mjs +23 -0
- package/core/src/shared/bytes.d.mts +2 -0
- package/core/src/shared/bytes.mjs +33 -0
- package/core/src/shared/sha256.d.mts +3 -0
- package/core/src/shared/sha256.mjs +72 -22
- package/core/units.d.ts +50 -0
- package/core/world.d.ts +253 -5
- package/dist/authority-room.d.ts +9 -0
- package/dist/authority-room.js +45 -16
- package/dist/browser.d.ts +6 -5
- package/dist/browser.js +4 -3
- package/dist/cadence.d.ts +7 -0
- package/dist/cadence.js +19 -0
- package/dist/canonical.d.ts +1 -0
- package/dist/canonical.js +3 -0
- package/dist/checksum-policy.d.ts +10 -0
- package/dist/checksum-policy.js +14 -0
- package/dist/collider-cooking-hull.d.ts +18 -0
- package/dist/collider-cooking-hull.js +248 -0
- package/dist/collider-cooking.d.ts +140 -0
- package/dist/collider-cooking.js +794 -0
- package/dist/compat/v5.d.ts +121 -0
- package/dist/compat/v5.js +479 -0
- package/dist/creator.d.ts +7 -6
- package/dist/creator.js +4 -3
- package/dist/game-byte-section.d.ts +36 -0
- package/dist/game-byte-section.js +350 -0
- package/dist/index.d.ts +13 -6
- package/dist/index.js +9 -4
- package/dist/instant-replay.d.ts +27 -2
- package/dist/instant-replay.js +91 -16
- package/dist/lag-compensation3d.js +11 -10
- package/dist/match-log.d.ts +21 -4
- package/dist/match-log.js +92 -9
- package/dist/math.d.ts +2 -0
- package/dist/math.js +1 -0
- package/dist/modules/character-3d.d.ts +16 -1
- package/dist/modules/character-3d.js +42 -5
- package/dist/modules/combat.js +6 -5
- package/dist/movement3d-revision1.d.ts +2 -0
- package/dist/movement3d-revision1.js +973 -0
- package/dist/movement3d.d.ts +53 -3
- package/dist/movement3d.js +917 -247
- package/dist/networked-client.d.ts +15 -0
- package/dist/networked-client.js +378 -105
- package/dist/node.d.ts +3 -2
- package/dist/node.js +2 -1
- package/dist/physics/2d.d.ts +38 -4
- package/dist/physics/2d.js +57 -36
- package/dist/physics/3d.d.ts +755 -111
- package/dist/physics/3d.js +2355 -158
- package/dist/physics/edit-result-graph.d.ts +36 -0
- package/dist/physics/edit-result-graph.js +141 -0
- package/dist/physics/game-codec3d.d.ts +41 -0
- package/dist/physics/game-codec3d.js +544 -0
- package/dist/physics/installed-checkpoint3d.d.ts +13 -0
- package/dist/physics/installed-checkpoint3d.js +120 -0
- package/dist/physics/installed-runtime3d.d.ts +51 -0
- package/dist/physics/installed-runtime3d.js +372 -0
- package/dist/physics/installed-state-commitment3d.d.ts +2 -0
- package/dist/physics/installed-state-commitment3d.js +24 -0
- package/dist/physics/units.d.ts +38 -0
- package/dist/physics/units.js +56 -0
- package/dist/physics/vehicle-state3d.d.ts +93 -0
- package/dist/physics/vehicle-state3d.js +1191 -0
- package/dist/physics/voxel-body-state.d.ts +61 -0
- package/dist/physics/voxel-body-state.js +410 -0
- package/dist/r3f-render-adapter.d.ts +59 -1
- package/dist/r3f-render-adapter.js +137 -2
- package/dist/replay.d.ts +13 -0
- package/dist/replay.js +95 -70
- package/dist/run-room-transport.js +5 -1
- package/dist/runner.d.ts +17 -2
- package/dist/runner.js +472 -84
- package/dist/runtime-cleanup.d.ts +54 -0
- package/dist/runtime-cleanup.js +266 -0
- package/dist/runtime-lease.d.ts +11 -1
- package/dist/runtime-lease.js +23 -10
- package/dist/runtime-room-metadata.d.ts +2 -8
- package/dist/runtime-room-metadata.js +11 -14
- package/dist/runtime-session.d.ts +8 -0
- package/dist/runtime-session.js +222 -58
- package/dist/schema-codegen.js +3 -0
- package/dist/schema-dsl-binary.d.ts +10 -4
- package/dist/schema-dsl-binary.js +375 -76
- package/dist/scratch-pool.d.ts +32 -0
- package/dist/scratch-pool.js +60 -0
- package/dist/sdk-session.d.ts +1 -0
- package/dist/sdk-session.js +4 -0
- package/dist/secret-config.js +2 -60
- package/dist/secret-crypto.js +70 -36
- package/dist/session-snapshot.d.ts +15 -4
- package/dist/session-snapshot.js +35 -33
- package/dist/session-wire.js +14 -22
- package/dist/sparse-set.d.ts +1 -0
- package/dist/sparse-set.js +22 -0
- package/dist/spatial/spatial-grid-3d.d.ts +41 -0
- package/dist/spatial/spatial-grid-3d.js +115 -0
- package/dist/synctest.d.ts +9 -0
- package/dist/synctest.js +106 -17
- package/dist/testing-network.d.ts +2 -0
- package/dist/testing-network.js +122 -18
- package/dist/testing.d.ts +27 -6
- package/dist/testing.js +297 -56
- package/dist/tools/index.d.ts +3 -2
- package/dist/tools/index.js +3 -2
- package/dist/tools/module-certification.d.ts +6 -0
- package/dist/tools/module-certification.js +26 -2
- package/package.json +18 -5
- package/core/scripts/run-box3d-benchmark.mjs +0 -350
- package/core/src/physics/index.mjs +0 -3169
|
@@ -1,36 +1,168 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type {
|
|
2
|
+
Meters,
|
|
3
|
+
Radians,
|
|
4
|
+
MetersPerSecond,
|
|
5
|
+
MetersPerSecondSquared,
|
|
6
|
+
RadiansPerSecond,
|
|
7
|
+
Newtons,
|
|
8
|
+
NewtonMeters,
|
|
9
|
+
NewtonSeconds,
|
|
10
|
+
Seconds,
|
|
11
|
+
Dimensionless,
|
|
12
|
+
Hertz,
|
|
13
|
+
Kilograms,
|
|
14
|
+
KilogramMetersSquared,
|
|
15
|
+
KilogramsPerSquareMeter,
|
|
16
|
+
PerSecond,
|
|
17
|
+
NewtonMeterSeconds,
|
|
18
|
+
MetersPerRadian,
|
|
19
|
+
RadiansPerMeter,
|
|
20
|
+
} from './units.js';
|
|
21
|
+
|
|
22
|
+
export interface PhysicsVertex2D<Quantity extends number> {
|
|
23
|
+
readonly x: Quantity;
|
|
24
|
+
readonly y: Quantity;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type PhysicsArcQuadrant2D = 'ne' | 'nw' | 'sw' | 'se';
|
|
28
|
+
|
|
29
|
+
export type PhysicsContourEdge2D =
|
|
30
|
+
| { readonly kind: 'line'; readonly to: PhysicsVertex2D<Meters> }
|
|
31
|
+
| {
|
|
32
|
+
readonly kind: 'arc';
|
|
33
|
+
readonly center: PhysicsVertex2D<Meters>;
|
|
34
|
+
readonly radius: Meters;
|
|
35
|
+
readonly quadrant: PhysicsArcQuadrant2D;
|
|
36
|
+
readonly convex?: boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export interface PhysicsContourLoop2D {
|
|
40
|
+
readonly start: PhysicsVertex2D<Meters>;
|
|
41
|
+
readonly edges: readonly PhysicsContourEdge2D[];
|
|
42
|
+
readonly closed?: boolean;
|
|
43
|
+
readonly before?: PhysicsVertex2D<Meters>;
|
|
44
|
+
readonly after?: PhysicsVertex2D<Meters>;
|
|
4
45
|
}
|
|
5
46
|
|
|
6
47
|
export type PhysicsShape2D =
|
|
7
|
-
| { readonly type: 'circle'; readonly radius:
|
|
8
|
-
| { readonly type: 'box'; readonly halfX:
|
|
9
|
-
| { readonly type: 'capsule'; readonly halfLength:
|
|
10
|
-
| { readonly type: 'polygon'; readonly vertices: readonly PhysicsVertex2D[] }
|
|
48
|
+
| { readonly type: 'circle'; readonly radius: Meters }
|
|
49
|
+
| { readonly type: 'box'; readonly halfX: Meters; readonly halfY: Meters }
|
|
50
|
+
| { readonly type: 'capsule'; readonly halfLength: Meters; readonly radius: Meters }
|
|
51
|
+
| { readonly type: 'polygon'; readonly vertices: readonly PhysicsVertex2D<Meters>[] }
|
|
52
|
+
| {
|
|
53
|
+
readonly type: 'segment';
|
|
54
|
+
readonly point1: PhysicsVertex2D<Meters>;
|
|
55
|
+
readonly point2: PhysicsVertex2D<Meters>;
|
|
56
|
+
readonly ghost1?: PhysicsVertex2D<Meters>;
|
|
57
|
+
readonly ghost2?: PhysicsVertex2D<Meters>;
|
|
58
|
+
readonly radius?: Meters;
|
|
59
|
+
}
|
|
60
|
+
| {
|
|
61
|
+
readonly type: 'chain';
|
|
62
|
+
readonly vertices: readonly PhysicsVertex2D<Meters>[];
|
|
63
|
+
readonly loop?: boolean;
|
|
64
|
+
readonly radius?: Meters;
|
|
65
|
+
}
|
|
66
|
+
| {
|
|
67
|
+
readonly type: 'contour';
|
|
68
|
+
readonly loops: readonly PhysicsContourLoop2D[];
|
|
69
|
+
readonly fill?: 'boundary' | 'solid';
|
|
70
|
+
readonly radius?: Meters;
|
|
71
|
+
readonly skin?: Meters;
|
|
72
|
+
}
|
|
73
|
+
| {
|
|
74
|
+
readonly type: 'arc';
|
|
75
|
+
readonly center: PhysicsVertex2D<Meters>;
|
|
76
|
+
readonly radius: Meters;
|
|
77
|
+
readonly quadrant: PhysicsArcQuadrant2D;
|
|
78
|
+
readonly convex: boolean;
|
|
79
|
+
};
|
|
11
80
|
|
|
12
|
-
export interface PhysicsJointLimit2D {
|
|
13
|
-
readonly lower:
|
|
14
|
-
readonly upper:
|
|
81
|
+
export interface PhysicsJointLimit2D<LimitUnit extends Meters | Radians> {
|
|
82
|
+
readonly lower: LimitUnit;
|
|
83
|
+
readonly upper: LimitUnit;
|
|
15
84
|
}
|
|
16
85
|
|
|
17
86
|
export interface PhysicsJointSpring2D {
|
|
18
|
-
readonly frequencyHz:
|
|
19
|
-
readonly dampingRatio:
|
|
87
|
+
readonly frequencyHz: Hertz;
|
|
88
|
+
readonly dampingRatio: Dimensionless;
|
|
20
89
|
}
|
|
21
90
|
|
|
22
91
|
export type PhysicsJointLimitState2D = 'inactive' | 'atLower' | 'atUpper' | 'equal';
|
|
23
92
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
93
|
+
type PhysicsJointBreakReason2D = 'force' | 'torque' | 'force-and-torque';
|
|
94
|
+
|
|
95
|
+
export interface PhysicsJointReaction2D {
|
|
96
|
+
readonly meanForce: PhysicsVertex2D<Newtons>;
|
|
97
|
+
readonly meanTorque: NewtonMeters;
|
|
98
|
+
readonly maximumSubstepForce: Newtons;
|
|
99
|
+
readonly maximumSubstepTorque: NewtonMeters;
|
|
100
|
+
readonly durationSeconds: Seconds;
|
|
101
|
+
readonly substepSeconds: Seconds;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type PhysicsGearEndpointReaction2D = {
|
|
105
|
+
readonly source: 'a' | 'b';
|
|
106
|
+
readonly sourceJointId: number;
|
|
107
|
+
readonly endpoint: 'a' | 'b';
|
|
108
|
+
readonly meanForce: PhysicsVertex2D<Newtons>;
|
|
109
|
+
readonly meanTorque: NewtonMeters;
|
|
110
|
+
readonly maximumSubstepForce: Newtons;
|
|
111
|
+
readonly maximumSubstepTorque: NewtonMeters;
|
|
112
|
+
} & (
|
|
113
|
+
| { readonly endpointKind: 'body'; readonly bodyId: number }
|
|
114
|
+
| { readonly endpointKind: 'world' }
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
type PhysicsGearEndpointReactionRow2D = readonly [
|
|
118
|
+
PhysicsGearEndpointReaction2D,
|
|
119
|
+
PhysicsGearEndpointReaction2D,
|
|
120
|
+
PhysicsGearEndpointReaction2D,
|
|
121
|
+
PhysicsGearEndpointReaction2D,
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
export interface PhysicsMeasuredJointTelemetry2D<
|
|
125
|
+
TType extends string,
|
|
126
|
+
TCoordinate extends number,
|
|
127
|
+
TSpeed extends number,
|
|
128
|
+
TMotorImpulse extends number,
|
|
129
|
+
> {
|
|
130
|
+
readonly jointId: number;
|
|
131
|
+
readonly type: TType;
|
|
132
|
+
readonly motorSaturated: boolean;
|
|
133
|
+
readonly breakReason?: PhysicsJointBreakReason2D;
|
|
134
|
+
readonly limitState: PhysicsJointLimitState2D;
|
|
135
|
+
readonly coordinate: TCoordinate;
|
|
136
|
+
readonly speed: TSpeed;
|
|
137
|
+
readonly reaction: PhysicsJointReaction2D;
|
|
138
|
+
readonly appliedMotorImpulse: TMotorImpulse;
|
|
30
139
|
}
|
|
31
140
|
|
|
141
|
+
export interface PhysicsGearJointTelemetry2D {
|
|
142
|
+
readonly jointId: number;
|
|
143
|
+
readonly type: 'gear';
|
|
144
|
+
readonly coordinate: Meters | Radians;
|
|
145
|
+
readonly speed: MetersPerSecond | RadiansPerSecond;
|
|
146
|
+
readonly breakReason?: PhysicsJointBreakReason2D;
|
|
147
|
+
readonly durationSeconds: Seconds;
|
|
148
|
+
readonly substepSeconds: Seconds;
|
|
149
|
+
readonly endpointReactions: PhysicsGearEndpointReactionRow2D;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export type PhysicsJointTelemetry2D =
|
|
153
|
+
| PhysicsMeasuredJointTelemetry2D<'distance', Meters, MetersPerSecond, NewtonSeconds>
|
|
154
|
+
| PhysicsMeasuredJointTelemetry2D<'revolute', Radians, RadiansPerSecond, NewtonMeterSeconds>
|
|
155
|
+
| PhysicsMeasuredJointTelemetry2D<'prismatic', Meters, MetersPerSecond, NewtonSeconds>
|
|
156
|
+
| PhysicsMeasuredJointTelemetry2D<'weld', Radians, RadiansPerSecond, 0>
|
|
157
|
+
| PhysicsMeasuredJointTelemetry2D<'wheel', Meters, MetersPerSecond, NewtonMeterSeconds>
|
|
158
|
+
| PhysicsMeasuredJointTelemetry2D<'motor', Radians, RadiansPerSecond, number>
|
|
159
|
+
| PhysicsMeasuredJointTelemetry2D<'mouse', Meters, MetersPerSecond, 0>
|
|
160
|
+
| PhysicsMeasuredJointTelemetry2D<'rope', Meters, MetersPerSecond, 0>
|
|
161
|
+
| PhysicsMeasuredJointTelemetry2D<'pulley', Meters, MetersPerSecond, 0>
|
|
162
|
+
| PhysicsGearJointTelemetry2D;
|
|
163
|
+
|
|
32
164
|
export interface PhysicsJointBreakEvent2D {
|
|
33
|
-
readonly jointId:
|
|
165
|
+
readonly jointId: number;
|
|
34
166
|
readonly substepIndex: number;
|
|
35
167
|
readonly reason: 'force' | 'torque' | 'force-and-torque';
|
|
36
168
|
}
|
|
@@ -38,73 +170,91 @@ export interface PhysicsJointBreakEvent2D {
|
|
|
38
170
|
export interface PhysicsQueryOptions2D {
|
|
39
171
|
readonly filter?: {
|
|
40
172
|
readonly bodyKinds?: readonly ('static' | 'kinematic' | 'dynamic')[];
|
|
41
|
-
readonly excludeBodyIds?: readonly
|
|
173
|
+
readonly excludeBodyIds?: readonly number[];
|
|
174
|
+
readonly layerMask?: number;
|
|
175
|
+
readonly hitSolids?: boolean;
|
|
176
|
+
readonly includeSensors?: boolean;
|
|
177
|
+
readonly includeTriggers?: boolean;
|
|
42
178
|
};
|
|
43
179
|
readonly maxResults?: number;
|
|
44
180
|
}
|
|
45
181
|
|
|
46
182
|
export interface PhysicsRaycastQuery2D extends PhysicsQueryOptions2D {
|
|
47
|
-
readonly x:
|
|
48
|
-
readonly y:
|
|
49
|
-
readonly dx:
|
|
50
|
-
readonly dy:
|
|
51
|
-
readonly maxDistance:
|
|
183
|
+
readonly x: Meters;
|
|
184
|
+
readonly y: Meters;
|
|
185
|
+
readonly dx: Dimensionless;
|
|
186
|
+
readonly dy: Dimensionless;
|
|
187
|
+
readonly maxDistance: Meters;
|
|
52
188
|
}
|
|
53
189
|
|
|
54
190
|
export interface PhysicsOverlapQuery2D extends PhysicsQueryOptions2D {
|
|
55
191
|
readonly shape: PhysicsShape2D;
|
|
56
|
-
readonly x:
|
|
57
|
-
readonly y:
|
|
58
|
-
readonly angle?:
|
|
192
|
+
readonly x: Meters;
|
|
193
|
+
readonly y: Meters;
|
|
194
|
+
readonly angle?: Radians;
|
|
59
195
|
}
|
|
60
196
|
|
|
61
197
|
export interface PhysicsShapeCastQuery2D extends PhysicsOverlapQuery2D {
|
|
62
|
-
readonly dx:
|
|
63
|
-
readonly dy:
|
|
64
|
-
readonly maxDistance:
|
|
198
|
+
readonly dx: Dimensionless;
|
|
199
|
+
readonly dy: Dimensionless;
|
|
200
|
+
readonly maxDistance: Meters;
|
|
65
201
|
}
|
|
66
202
|
|
|
67
203
|
export interface PhysicsClosestPointsQuery2D extends PhysicsQueryOptions2D {
|
|
68
|
-
readonly x:
|
|
69
|
-
readonly y:
|
|
204
|
+
readonly x: Meters;
|
|
205
|
+
readonly y: Meters;
|
|
70
206
|
}
|
|
71
207
|
|
|
72
208
|
export type PhysicsCastHit2D =
|
|
73
209
|
| {
|
|
74
210
|
readonly kind: 'surfaceHit';
|
|
75
|
-
readonly bodyId:
|
|
76
|
-
readonly distance:
|
|
77
|
-
readonly fraction:
|
|
78
|
-
readonly point: PhysicsVertex2D
|
|
79
|
-
readonly normal: PhysicsVertex2D
|
|
211
|
+
readonly bodyId: number;
|
|
212
|
+
readonly distance: Meters;
|
|
213
|
+
readonly fraction: Dimensionless;
|
|
214
|
+
readonly point: PhysicsVertex2D<Meters>;
|
|
215
|
+
readonly normal: PhysicsVertex2D<Dimensionless>;
|
|
80
216
|
readonly featureId: number;
|
|
81
217
|
}
|
|
82
218
|
| {
|
|
83
219
|
readonly kind: 'initialOverlap';
|
|
84
|
-
readonly bodyId:
|
|
85
|
-
readonly distance: 0;
|
|
220
|
+
readonly bodyId: number;
|
|
221
|
+
readonly distance: Meters & 0;
|
|
86
222
|
readonly fraction: 0;
|
|
87
223
|
};
|
|
88
224
|
|
|
225
|
+
export interface PhysicsOverlapContactPoint2D {
|
|
226
|
+
readonly x: Meters;
|
|
227
|
+
readonly y: Meters;
|
|
228
|
+
readonly featureId: number;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface PhysicsOverlapContact2D {
|
|
232
|
+
readonly bodyId: number;
|
|
233
|
+
readonly normal: PhysicsVertex2D<Dimensionless>;
|
|
234
|
+
readonly depth: Meters;
|
|
235
|
+
readonly points: readonly PhysicsOverlapContactPoint2D[];
|
|
236
|
+
}
|
|
237
|
+
|
|
89
238
|
export type PhysicsClosestPointResult2D =
|
|
90
239
|
| {
|
|
91
240
|
readonly kind: 'inside';
|
|
92
|
-
readonly bodyId:
|
|
93
|
-
readonly point: PhysicsVertex2D
|
|
94
|
-
readonly distance: 0;
|
|
241
|
+
readonly bodyId: number;
|
|
242
|
+
readonly point: PhysicsVertex2D<Meters>;
|
|
243
|
+
readonly distance: Meters & 0;
|
|
95
244
|
}
|
|
96
245
|
| {
|
|
97
246
|
readonly kind: 'surfacePoint';
|
|
98
|
-
readonly bodyId:
|
|
99
|
-
readonly point: PhysicsVertex2D
|
|
100
|
-
readonly distance:
|
|
247
|
+
readonly bodyId: number;
|
|
248
|
+
readonly point: PhysicsVertex2D<Meters>;
|
|
249
|
+
readonly distance: Meters;
|
|
101
250
|
readonly featureId: number;
|
|
102
251
|
};
|
|
103
252
|
|
|
104
253
|
export type PhysicsBodyId2D = number & { readonly __brand: unique symbol };
|
|
105
254
|
export type PhysicsJointId2D = number & { readonly __brand: unique symbol };
|
|
255
|
+
export type PhysicsFluidId2D = number & { readonly __brand: unique symbol };
|
|
106
256
|
|
|
107
|
-
export interface PhysicsEntityHandle2D<TKind extends 'body' | 'joint' = 'body' | 'joint'> {
|
|
257
|
+
export interface PhysicsEntityHandle2D<TKind extends 'body' | 'joint' | 'fluid' = 'body' | 'joint' | 'fluid'> {
|
|
108
258
|
readonly kind: TKind;
|
|
109
259
|
readonly id: number;
|
|
110
260
|
readonly owner: bigint;
|
|
@@ -113,82 +263,112 @@ export interface PhysicsEntityHandle2D<TKind extends 'body' | 'joint' = 'body' |
|
|
|
113
263
|
|
|
114
264
|
export type PhysicsBodyHandle2D = PhysicsEntityHandle2D<'body'>;
|
|
115
265
|
export type PhysicsJointHandle2D = PhysicsEntityHandle2D<'joint'>;
|
|
266
|
+
export type PhysicsFluidHandle2D = PhysicsEntityHandle2D<'fluid'>;
|
|
116
267
|
|
|
117
|
-
export interface PhysicsPendingReference2D<TKind extends 'body' | 'joint' = 'body' | 'joint'> {
|
|
268
|
+
export interface PhysicsPendingReference2D<TKind extends 'body' | 'joint' | 'fluid' = 'body' | 'joint' | 'fluid'> {
|
|
118
269
|
readonly kind: TKind;
|
|
119
270
|
readonly createdKey: number;
|
|
120
271
|
}
|
|
121
272
|
|
|
122
273
|
export type PhysicsPendingBodyReference2D = PhysicsPendingReference2D<'body'>;
|
|
123
274
|
export type PhysicsPendingJointReference2D = PhysicsPendingReference2D<'joint'>;
|
|
275
|
+
export type PhysicsPendingFluidReference2D = PhysicsPendingReference2D<'fluid'>;
|
|
124
276
|
|
|
125
277
|
export type PhysicsBodyRef2D = PhysicsBodyHandle2D | PhysicsPendingBodyReference2D;
|
|
126
278
|
export type PhysicsJointRef2D = PhysicsJointHandle2D | PhysicsPendingJointReference2D;
|
|
279
|
+
export type PhysicsFluidRef2D = PhysicsFluidHandle2D | PhysicsPendingFluidReference2D;
|
|
127
280
|
|
|
128
281
|
export interface PhysicsWorldCapacity2D {
|
|
282
|
+
readonly checkpoints?: number;
|
|
129
283
|
readonly bodies?: number;
|
|
130
284
|
readonly joints?: number;
|
|
285
|
+
readonly fluids?: number;
|
|
131
286
|
readonly body?: number;
|
|
132
287
|
readonly joint?: number;
|
|
288
|
+
readonly fluid?: number;
|
|
289
|
+
readonly contacts?: number;
|
|
290
|
+
readonly contact?: number;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface PhysicsContactEvent2D {
|
|
294
|
+
readonly type: 'enter' | 'stay' | 'exit';
|
|
295
|
+
readonly bodyA: number;
|
|
296
|
+
readonly bodyB: number;
|
|
297
|
+
readonly trigger: boolean;
|
|
298
|
+
readonly sensor: boolean;
|
|
299
|
+
readonly material: {
|
|
300
|
+
readonly friction: Dimensionless;
|
|
301
|
+
readonly restitution: Dimensionless;
|
|
302
|
+
};
|
|
133
303
|
}
|
|
134
304
|
|
|
135
305
|
export interface PhysicsWorldDefinition2D {
|
|
136
306
|
readonly tickRate?: 10 | 20 | 30 | 60;
|
|
137
|
-
readonly initialGravity?: { readonly x:
|
|
307
|
+
readonly initialGravity?: { readonly x: MetersPerSecondSquared; readonly y: MetersPerSecondSquared };
|
|
138
308
|
readonly substeps?: number;
|
|
139
309
|
readonly velocityIterations?: number;
|
|
140
310
|
readonly capacity: PhysicsWorldCapacity2D;
|
|
141
311
|
}
|
|
142
312
|
|
|
143
313
|
export interface PhysicsBody2D {
|
|
314
|
+
readonly layer: number;
|
|
315
|
+
readonly mask: number;
|
|
316
|
+
readonly trigger: boolean;
|
|
317
|
+
readonly sensor: boolean;
|
|
318
|
+
readonly ccd: boolean;
|
|
144
319
|
readonly id: number;
|
|
145
320
|
readonly kind: 'static' | 'kinematic' | 'dynamic';
|
|
146
321
|
readonly shape: PhysicsShape2D;
|
|
147
|
-
readonly x:
|
|
148
|
-
readonly y:
|
|
149
|
-
readonly angle:
|
|
150
|
-
readonly vx:
|
|
151
|
-
readonly vy:
|
|
152
|
-
readonly angularVelocity:
|
|
153
|
-
readonly mass:
|
|
154
|
-
readonly inertia:
|
|
155
|
-
readonly friction:
|
|
156
|
-
readonly restitution:
|
|
157
|
-
readonly forceX:
|
|
158
|
-
readonly forceY:
|
|
159
|
-
readonly torque:
|
|
322
|
+
readonly x: Meters;
|
|
323
|
+
readonly y: Meters;
|
|
324
|
+
readonly angle: Radians;
|
|
325
|
+
readonly vx: MetersPerSecond;
|
|
326
|
+
readonly vy: MetersPerSecond;
|
|
327
|
+
readonly angularVelocity: RadiansPerSecond;
|
|
328
|
+
readonly mass: Kilograms;
|
|
329
|
+
readonly inertia: KilogramMetersSquared;
|
|
330
|
+
readonly friction: Dimensionless;
|
|
331
|
+
readonly restitution: Dimensionless;
|
|
332
|
+
readonly forceX: Newtons;
|
|
333
|
+
readonly forceY: Newtons;
|
|
334
|
+
readonly torque: NewtonMeters;
|
|
160
335
|
}
|
|
161
336
|
|
|
162
337
|
export interface PhysicsBodyInput2D {
|
|
338
|
+
readonly layer?: number;
|
|
339
|
+
readonly mask?: number;
|
|
340
|
+
readonly trigger?: boolean;
|
|
341
|
+
readonly sensor?: boolean;
|
|
342
|
+
readonly ccd?: boolean;
|
|
163
343
|
readonly kind?: 'static' | 'kinematic' | 'dynamic';
|
|
164
344
|
readonly shape: PhysicsShape2D;
|
|
165
|
-
readonly x?:
|
|
166
|
-
readonly y?:
|
|
167
|
-
readonly angle?:
|
|
168
|
-
readonly vx?:
|
|
169
|
-
readonly vy?:
|
|
170
|
-
readonly angularVelocity?:
|
|
171
|
-
readonly mass?:
|
|
172
|
-
readonly inertia?:
|
|
173
|
-
readonly friction?:
|
|
174
|
-
readonly restitution?:
|
|
175
|
-
readonly forceX?:
|
|
176
|
-
readonly forceY?:
|
|
177
|
-
readonly torque?:
|
|
345
|
+
readonly x?: Meters;
|
|
346
|
+
readonly y?: Meters;
|
|
347
|
+
readonly angle?: Radians;
|
|
348
|
+
readonly vx?: MetersPerSecond;
|
|
349
|
+
readonly vy?: MetersPerSecond;
|
|
350
|
+
readonly angularVelocity?: RadiansPerSecond;
|
|
351
|
+
readonly mass?: Kilograms;
|
|
352
|
+
readonly inertia?: KilogramMetersSquared;
|
|
353
|
+
readonly friction?: Dimensionless;
|
|
354
|
+
readonly restitution?: Dimensionless;
|
|
355
|
+
readonly forceX?: Newtons;
|
|
356
|
+
readonly forceY?: Newtons;
|
|
357
|
+
readonly torque?: NewtonMeters;
|
|
178
358
|
}
|
|
179
359
|
|
|
180
360
|
export interface PhysicsJointEndpointBody2D {
|
|
181
361
|
readonly kind?: 'body';
|
|
182
362
|
readonly body: PhysicsBodyRef2D;
|
|
183
|
-
readonly frame?: { readonly x?:
|
|
363
|
+
readonly frame?: { readonly x?: Meters; readonly y?: Meters; readonly angle?: Radians };
|
|
184
364
|
}
|
|
185
365
|
|
|
186
366
|
export interface PhysicsJointEndpointWorld2D {
|
|
187
367
|
readonly kind?: 'world';
|
|
188
|
-
readonly frame?: { readonly x?:
|
|
189
|
-
readonly x?:
|
|
190
|
-
readonly y?:
|
|
191
|
-
readonly angle?:
|
|
368
|
+
readonly frame?: { readonly x?: Meters; readonly y?: Meters; readonly angle?: Radians };
|
|
369
|
+
readonly x?: Meters;
|
|
370
|
+
readonly y?: Meters;
|
|
371
|
+
readonly angle?: Radians;
|
|
192
372
|
}
|
|
193
373
|
|
|
194
374
|
export type PhysicsJointEndpointInput2D =
|
|
@@ -199,42 +379,42 @@ export type PhysicsJointEndpointInput2D =
|
|
|
199
379
|
export interface PhysicsJointCommonInput2D {
|
|
200
380
|
readonly enabled?: boolean;
|
|
201
381
|
readonly collideConnected?: boolean;
|
|
202
|
-
readonly breakForce?:
|
|
203
|
-
readonly breakTorque?:
|
|
382
|
+
readonly breakForce?: Newtons;
|
|
383
|
+
readonly breakTorque?: NewtonMeters;
|
|
204
384
|
}
|
|
205
385
|
|
|
206
386
|
export interface PhysicsDistanceJointInput2D extends PhysicsJointCommonInput2D {
|
|
207
387
|
readonly type: 'distance';
|
|
208
388
|
readonly a: PhysicsJointEndpointInput2D;
|
|
209
389
|
readonly b: PhysicsJointEndpointInput2D;
|
|
210
|
-
readonly restLength?:
|
|
211
|
-
readonly limit?: PhysicsJointLimit2D
|
|
390
|
+
readonly restLength?: Meters;
|
|
391
|
+
readonly limit?: PhysicsJointLimit2D<Meters>;
|
|
212
392
|
readonly spring?: PhysicsJointSpring2D;
|
|
213
|
-
readonly drive?: { readonly mode: 'velocity'; readonly speed:
|
|
393
|
+
readonly drive?: { readonly mode: 'velocity'; readonly speed: MetersPerSecond; readonly maxForce: Newtons };
|
|
214
394
|
}
|
|
215
395
|
|
|
216
396
|
export interface PhysicsRevoluteJointInput2D extends PhysicsJointCommonInput2D {
|
|
217
397
|
readonly type: 'revolute';
|
|
218
398
|
readonly a: PhysicsJointEndpointInput2D;
|
|
219
399
|
readonly b: PhysicsJointEndpointInput2D;
|
|
220
|
-
readonly limit?: PhysicsJointLimit2D
|
|
400
|
+
readonly limit?: PhysicsJointLimit2D<Radians>;
|
|
221
401
|
readonly spring?: PhysicsJointSpring2D;
|
|
222
402
|
readonly drive?:
|
|
223
|
-
| { readonly mode: 'velocity'; readonly speed:
|
|
224
|
-
| { readonly mode: 'servo'; readonly target:
|
|
225
|
-
readonly frictionTorque?:
|
|
403
|
+
| { readonly mode: 'velocity'; readonly speed: RadiansPerSecond; readonly maxTorque: NewtonMeters }
|
|
404
|
+
| { readonly mode: 'servo'; readonly target: Radians; readonly maxTorque: NewtonMeters; readonly frequencyHz: Hertz; readonly dampingRatio: Dimensionless };
|
|
405
|
+
readonly frictionTorque?: NewtonMeters;
|
|
226
406
|
}
|
|
227
407
|
|
|
228
408
|
export interface PhysicsPrismaticJointInput2D extends PhysicsJointCommonInput2D {
|
|
229
409
|
readonly type: 'prismatic';
|
|
230
410
|
readonly a: PhysicsJointEndpointInput2D;
|
|
231
411
|
readonly b: PhysicsJointEndpointInput2D;
|
|
232
|
-
readonly limit?: PhysicsJointLimit2D
|
|
412
|
+
readonly limit?: PhysicsJointLimit2D<Meters>;
|
|
233
413
|
readonly spring?: PhysicsJointSpring2D;
|
|
234
414
|
readonly drive?:
|
|
235
|
-
| { readonly mode: 'velocity'; readonly speed:
|
|
236
|
-
| { readonly mode: 'servo'; readonly target:
|
|
237
|
-
readonly frictionForce?:
|
|
415
|
+
| { readonly mode: 'velocity'; readonly speed: MetersPerSecond; readonly maxForce: Newtons }
|
|
416
|
+
| { readonly mode: 'servo'; readonly target: Meters; readonly maxForce: Newtons; readonly frequencyHz: Hertz; readonly dampingRatio: Dimensionless };
|
|
417
|
+
readonly frictionForce?: Newtons;
|
|
238
418
|
}
|
|
239
419
|
|
|
240
420
|
export interface PhysicsWeldJointInput2D extends PhysicsJointCommonInput2D {
|
|
@@ -245,52 +425,199 @@ export interface PhysicsWeldJointInput2D extends PhysicsJointCommonInput2D {
|
|
|
245
425
|
readonly angularSpring?: PhysicsJointSpring2D;
|
|
246
426
|
}
|
|
247
427
|
|
|
428
|
+
export interface PhysicsWheelJointInput2D extends PhysicsJointCommonInput2D {
|
|
429
|
+
readonly type: 'wheel';
|
|
430
|
+
readonly a: PhysicsJointEndpointInput2D;
|
|
431
|
+
readonly b: PhysicsJointEndpointInput2D;
|
|
432
|
+
readonly restTranslation?: Meters;
|
|
433
|
+
readonly limit?: PhysicsJointLimit2D<Meters>;
|
|
434
|
+
readonly spring?: PhysicsJointSpring2D;
|
|
435
|
+
readonly drive?: { readonly mode: 'velocity'; readonly speed: RadiansPerSecond; readonly maxTorque: NewtonMeters };
|
|
436
|
+
readonly brakeTorque?: NewtonMeters;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export interface PhysicsMotorJointInput2D extends PhysicsJointCommonInput2D {
|
|
440
|
+
readonly type: 'motor';
|
|
441
|
+
readonly a: PhysicsJointEndpointInput2D;
|
|
442
|
+
readonly b: PhysicsJointEndpointInput2D;
|
|
443
|
+
readonly target: { readonly x: Meters; readonly y: Meters; readonly angle: Radians };
|
|
444
|
+
readonly correctionFactor: Dimensionless;
|
|
445
|
+
readonly maxForce: Newtons;
|
|
446
|
+
readonly maxTorque: NewtonMeters;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
export interface PhysicsMouseJointInput2D extends PhysicsJointCommonInput2D {
|
|
450
|
+
readonly type: 'mouse';
|
|
451
|
+
readonly a: PhysicsJointEndpointWorld2D;
|
|
452
|
+
readonly b: PhysicsBodyRef2D | PhysicsJointEndpointBody2D;
|
|
453
|
+
readonly spring?: PhysicsJointSpring2D;
|
|
454
|
+
readonly maxForce: Newtons;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export interface PhysicsRopeJointInput2D extends PhysicsJointCommonInput2D {
|
|
458
|
+
readonly type: 'rope';
|
|
459
|
+
readonly a: PhysicsJointEndpointInput2D;
|
|
460
|
+
readonly b: PhysicsJointEndpointInput2D;
|
|
461
|
+
readonly maxLength: Meters;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export interface PhysicsPulleyJointInput2D extends Omit<PhysicsJointCommonInput2D, 'breakTorque'> {
|
|
465
|
+
readonly type: 'pulley';
|
|
466
|
+
readonly a: PhysicsBodyRef2D | PhysicsJointEndpointBody2D;
|
|
467
|
+
readonly b: PhysicsBodyRef2D | PhysicsJointEndpointBody2D;
|
|
468
|
+
readonly groundA: PhysicsVertex2D<Meters>;
|
|
469
|
+
readonly groundB: PhysicsVertex2D<Meters>;
|
|
470
|
+
readonly ratio: Dimensionless;
|
|
471
|
+
readonly totalLength: Meters;
|
|
472
|
+
readonly mode: 'fixedLength' | 'maxLength';
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
interface PhysicsGearJointBaseInput2D extends Omit<PhysicsJointCommonInput2D, 'collideConnected'> {
|
|
476
|
+
readonly type: 'gear';
|
|
477
|
+
readonly sourceA: PhysicsJointRef2D;
|
|
478
|
+
readonly sourceB: PhysicsJointRef2D;
|
|
479
|
+
readonly breakSource?: { readonly source: 'a' | 'b'; readonly endpoint: 'a' | 'b' };
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export interface PhysicsGearJointDimensionlessInput2D extends PhysicsGearJointBaseInput2D {
|
|
483
|
+
readonly ratioUnit: 'dimensionless';
|
|
484
|
+
readonly ratio: Dimensionless;
|
|
485
|
+
readonly phase: Meters | Radians;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export interface PhysicsGearJointWorldUnitsPerRadianInput2D extends PhysicsGearJointBaseInput2D {
|
|
489
|
+
readonly ratioUnit: 'worldUnitsPerRadian';
|
|
490
|
+
readonly ratio: MetersPerRadian;
|
|
491
|
+
readonly phase: Meters;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
export interface PhysicsGearJointRadiansPerWorldUnitInput2D extends PhysicsGearJointBaseInput2D {
|
|
495
|
+
readonly ratioUnit: 'radiansPerWorldUnit';
|
|
496
|
+
readonly ratio: RadiansPerMeter;
|
|
497
|
+
readonly phase: Radians;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export type PhysicsGearJointInput2D =
|
|
501
|
+
| PhysicsGearJointDimensionlessInput2D
|
|
502
|
+
| PhysicsGearJointWorldUnitsPerRadianInput2D
|
|
503
|
+
| PhysicsGearJointRadiansPerWorldUnitInput2D;
|
|
504
|
+
|
|
248
505
|
export type PhysicsJointInput2D =
|
|
249
506
|
| PhysicsDistanceJointInput2D
|
|
250
507
|
| PhysicsRevoluteJointInput2D
|
|
251
508
|
| PhysicsPrismaticJointInput2D
|
|
252
|
-
| PhysicsWeldJointInput2D
|
|
509
|
+
| PhysicsWeldJointInput2D
|
|
510
|
+
| PhysicsWheelJointInput2D
|
|
511
|
+
| PhysicsMotorJointInput2D
|
|
512
|
+
| PhysicsMouseJointInput2D
|
|
513
|
+
| PhysicsRopeJointInput2D
|
|
514
|
+
| PhysicsPulleyJointInput2D
|
|
515
|
+
| PhysicsGearJointInput2D;
|
|
516
|
+
|
|
517
|
+
export interface PhysicsFluidInput2D {
|
|
518
|
+
readonly density: KilogramsPerSquareMeter;
|
|
519
|
+
readonly bounds: {
|
|
520
|
+
readonly minX: Meters;
|
|
521
|
+
readonly maxX: Meters;
|
|
522
|
+
readonly minY: Meters;
|
|
523
|
+
readonly maxY: Meters;
|
|
524
|
+
};
|
|
525
|
+
readonly linearDragPerSecond?: PerSecond;
|
|
526
|
+
readonly angularDragPerSecond?: PerSecond;
|
|
527
|
+
readonly flowVelocity?: PhysicsVertex2D<MetersPerSecond>;
|
|
528
|
+
readonly plane?: {
|
|
529
|
+
readonly normal: PhysicsVertex2D<Dimensionless>;
|
|
530
|
+
readonly offset: Meters;
|
|
531
|
+
};
|
|
532
|
+
}
|
|
253
533
|
|
|
254
|
-
export interface
|
|
534
|
+
export interface PhysicsFluid2D extends Required<Omit<PhysicsFluidInput2D, 'plane'>> {
|
|
535
|
+
readonly id: number;
|
|
536
|
+
readonly plane?: { readonly normal: PhysicsVertex2D<Dimensionless>; readonly offset: Meters };
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
export interface PhysicsJointStateShape2D<
|
|
540
|
+
TType extends string,
|
|
541
|
+
TCoordinate extends number,
|
|
542
|
+
TImpulse extends readonly [number, number, number, number, number, number, number, number],
|
|
543
|
+
TSignature extends bigint = bigint,
|
|
544
|
+
> {
|
|
255
545
|
readonly jointId: number;
|
|
256
|
-
readonly type:
|
|
546
|
+
readonly type: TType;
|
|
257
547
|
readonly broken: boolean;
|
|
258
548
|
readonly limitState: PhysicsJointLimitState2D;
|
|
259
549
|
readonly warmSignature: bigint;
|
|
260
|
-
readonly coordinateSignature:
|
|
261
|
-
readonly previousSubstepDuration:
|
|
262
|
-
readonly unwrappedCoordinate:
|
|
263
|
-
readonly previousWrappedCoordinate:
|
|
550
|
+
readonly coordinateSignature: TSignature;
|
|
551
|
+
readonly previousSubstepDuration: Seconds;
|
|
552
|
+
readonly unwrappedCoordinate: TCoordinate;
|
|
553
|
+
readonly previousWrappedCoordinate: TCoordinate;
|
|
264
554
|
readonly activeRowMask: number;
|
|
265
|
-
readonly accumulatedImpulse:
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
555
|
+
readonly accumulatedImpulse: TImpulse;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export type PhysicsJointState2D =
|
|
559
|
+
| PhysicsJointStateShape2D<'distance', Meters, readonly [NewtonSeconds, NewtonSeconds, NewtonSeconds, NewtonSeconds, 0, 0, 0, 0]>
|
|
560
|
+
| PhysicsJointStateShape2D<'revolute', Radians, readonly [NewtonSeconds, NewtonSeconds, NewtonMeterSeconds, NewtonMeterSeconds, NewtonMeterSeconds, NewtonMeterSeconds, NewtonMeterSeconds, 0]>
|
|
561
|
+
| PhysicsJointStateShape2D<'prismatic', Meters, readonly [NewtonSeconds, NewtonMeterSeconds, NewtonSeconds, NewtonSeconds, NewtonSeconds, NewtonSeconds, NewtonSeconds, 0]>
|
|
562
|
+
| PhysicsJointStateShape2D<'weld', Radians, readonly [NewtonSeconds, NewtonSeconds, NewtonMeterSeconds, 0, 0, 0, 0, 0]>
|
|
563
|
+
| PhysicsJointStateShape2D<'wheel', Meters, readonly [NewtonSeconds, NewtonSeconds, NewtonSeconds, NewtonSeconds, NewtonMeterSeconds, NewtonMeterSeconds, 0, 0]>
|
|
564
|
+
| PhysicsJointStateShape2D<'motor', Radians, readonly [NewtonSeconds, NewtonSeconds, NewtonMeterSeconds, 0, 0, 0, 0, 0]>
|
|
565
|
+
| PhysicsJointStateShape2D<'mouse', Meters, readonly [NewtonSeconds, NewtonSeconds, 0, 0, 0, 0, 0, 0]>
|
|
566
|
+
| PhysicsJointStateShape2D<'rope', Meters, readonly [NewtonSeconds, 0, 0, 0, 0, 0, 0, 0]>
|
|
567
|
+
| PhysicsJointStateShape2D<'pulley', 0, readonly [NewtonSeconds, 0, 0, 0, 0, 0, 0, 0], 0n>
|
|
568
|
+
| PhysicsJointStateShape2D<'gear', 0, readonly [number, 0, 0, 0, 0, 0, 0, 0], 0n>;
|
|
569
|
+
|
|
570
|
+
type JointEndpointReadback2D =
|
|
571
|
+
| { readonly kind: 'body'; readonly bodyId: number;
|
|
572
|
+
readonly frame: { readonly x: Meters; readonly y: Meters; readonly angle: Radians } }
|
|
573
|
+
| { readonly kind: 'world';
|
|
574
|
+
readonly frame: { readonly x: Meters; readonly y: Meters; readonly angle: Radians } };
|
|
575
|
+
|
|
576
|
+
type JointReadback2D<T extends PhysicsJointInput2D> = T extends PhysicsGearJointInput2D
|
|
577
|
+
? Omit<T, 'sourceA' | 'sourceB'> & {
|
|
578
|
+
readonly id: number;
|
|
579
|
+
readonly sourceA: number;
|
|
580
|
+
readonly sourceB: number;
|
|
581
|
+
readonly enabled: boolean;
|
|
582
|
+
readonly breakForce: Newtons;
|
|
583
|
+
readonly breakTorque: NewtonMeters;
|
|
584
|
+
readonly state: Extract<PhysicsJointState2D, { readonly type: 'gear' }>;
|
|
585
|
+
}
|
|
586
|
+
: Omit<T, 'a' | 'b'> & {
|
|
587
|
+
readonly id: number;
|
|
588
|
+
readonly a: JointEndpointReadback2D;
|
|
589
|
+
readonly b: JointEndpointReadback2D;
|
|
590
|
+
readonly enabled: boolean;
|
|
591
|
+
readonly collideConnected: boolean;
|
|
592
|
+
readonly breakForce: Newtons;
|
|
593
|
+
readonly breakTorque: T extends PhysicsPulleyJointInput2D ? 0 : NewtonMeters;
|
|
594
|
+
readonly state: Extract<PhysicsJointState2D, { readonly type: T['type'] }>;
|
|
595
|
+
};
|
|
269
596
|
|
|
270
|
-
export
|
|
271
|
-
readonly id: number;
|
|
272
|
-
readonly type: string;
|
|
273
|
-
readonly state: PhysicsJointState2D;
|
|
274
|
-
readonly [key: string]: unknown;
|
|
275
|
-
}
|
|
597
|
+
export type PhysicsJointRecord2D = JointReadback2D<PhysicsJointInput2D>;
|
|
276
598
|
|
|
277
599
|
export interface PhysicsLatestOutputs2D {
|
|
278
600
|
readonly info: {
|
|
279
601
|
readonly telemetryCount: number;
|
|
280
602
|
readonly breakEventCount: number;
|
|
281
603
|
readonly gearReactionCount: number;
|
|
604
|
+
readonly contactEventCount: number;
|
|
282
605
|
readonly frame: bigint;
|
|
283
606
|
readonly latestStepOptions: {
|
|
284
|
-
readonly dt:
|
|
285
|
-
readonly gravityX:
|
|
286
|
-
readonly gravityY:
|
|
607
|
+
readonly dt: Seconds;
|
|
608
|
+
readonly gravityX: MetersPerSecondSquared;
|
|
609
|
+
readonly gravityY: MetersPerSecondSquared;
|
|
287
610
|
readonly substeps: number;
|
|
288
611
|
readonly velocityIterations: number;
|
|
289
612
|
};
|
|
290
613
|
};
|
|
291
614
|
readonly telemetry: readonly PhysicsJointTelemetry2D[];
|
|
292
615
|
readonly breakEvents: readonly PhysicsJointBreakEvent2D[];
|
|
293
|
-
readonly gearReactions: readonly {
|
|
616
|
+
readonly gearReactions: readonly {
|
|
617
|
+
readonly jointId: number;
|
|
618
|
+
readonly reactions: PhysicsGearEndpointReactionRow2D;
|
|
619
|
+
}[];
|
|
620
|
+
readonly contacts: readonly PhysicsContactEvent2D[];
|
|
294
621
|
}
|
|
295
622
|
|
|
296
623
|
export interface PhysicsWorldInfo2D {
|
|
@@ -301,32 +628,36 @@ export interface PhysicsWorldInfo2D {
|
|
|
301
628
|
readonly physicsProfile: number;
|
|
302
629
|
readonly bodyCount: number;
|
|
303
630
|
readonly jointCount: number;
|
|
631
|
+
readonly fluidCount: number;
|
|
304
632
|
readonly latestTelemetryCount: number;
|
|
305
633
|
readonly latestBreakEventCount: number;
|
|
306
634
|
readonly latestGearReactionCount: number;
|
|
635
|
+
readonly latestContactEventCount: number;
|
|
307
636
|
readonly bodyCapacity: number;
|
|
308
637
|
readonly jointCapacity: number;
|
|
638
|
+
readonly fluidCapacity: number;
|
|
639
|
+
readonly contactCapacity: number;
|
|
309
640
|
readonly owner: bigint;
|
|
310
641
|
readonly epoch: bigint;
|
|
311
642
|
readonly frame: bigint;
|
|
312
643
|
readonly retainedBytes: bigint;
|
|
313
644
|
readonly captureBytes: bigint;
|
|
314
645
|
readonly latestStepOptions: {
|
|
315
|
-
readonly dt:
|
|
316
|
-
readonly gravityX:
|
|
317
|
-
readonly gravityY:
|
|
646
|
+
readonly dt: Seconds;
|
|
647
|
+
readonly gravityX: MetersPerSecondSquared;
|
|
648
|
+
readonly gravityY: MetersPerSecondSquared;
|
|
318
649
|
readonly substeps: number;
|
|
319
650
|
readonly velocityIterations: number;
|
|
320
651
|
};
|
|
321
|
-
readonly fixedDt:
|
|
322
|
-
readonly currentGravityX:
|
|
323
|
-
readonly currentGravityY:
|
|
652
|
+
readonly fixedDt: Seconds;
|
|
653
|
+
readonly currentGravityX: MetersPerSecondSquared;
|
|
654
|
+
readonly currentGravityY: MetersPerSecondSquared;
|
|
324
655
|
readonly fixedSubsteps: number;
|
|
325
656
|
readonly fixedVelocityIterations: number;
|
|
326
657
|
}
|
|
327
658
|
|
|
328
659
|
export interface PhysicsRemovedIdentity2D {
|
|
329
|
-
readonly kind: 'body' | 'joint';
|
|
660
|
+
readonly kind: 'body' | 'joint' | 'fluid';
|
|
330
661
|
readonly kindCode: number;
|
|
331
662
|
readonly id: number;
|
|
332
663
|
}
|
|
@@ -338,8 +669,9 @@ export interface PhysicsCheckpoint2D {
|
|
|
338
669
|
|
|
339
670
|
/**
|
|
340
671
|
* The shape the edit builder returned, with each pending reference replaced by the
|
|
341
|
-
* live handle the batch produced. Arrays, plain objects, Sets and Maps are rebuilt
|
|
342
|
-
*
|
|
672
|
+
* live handle the batch produced. Arrays, plain objects, Sets and Maps are rebuilt.
|
|
673
|
+
* number, string, bigint, and boolean pass through before the object branch, so a
|
|
674
|
+
* branded quantity stays that quantity.
|
|
343
675
|
*/
|
|
344
676
|
export type PhysicsResolvedReferences2D<T> =
|
|
345
677
|
T extends PhysicsEntityHandle2D<infer TKind> ? PhysicsEntityHandle2D<TKind>
|
|
@@ -348,8 +680,9 @@ export type PhysicsResolvedReferences2D<T> =
|
|
|
348
680
|
: T extends Set<infer TItem> ? Set<PhysicsResolvedReferences2D<TItem>>
|
|
349
681
|
: T extends Map<infer TKey, infer TItem> ? Map<TKey, PhysicsResolvedReferences2D<TItem>>
|
|
350
682
|
: T extends (...args: readonly never[]) => unknown ? T
|
|
351
|
-
: T extends
|
|
352
|
-
: T
|
|
683
|
+
: T extends number | string | bigint | boolean ? T
|
|
684
|
+
: T extends object ? { readonly [K in keyof T]: PhysicsResolvedReferences2D<T[K]> }
|
|
685
|
+
: T;
|
|
353
686
|
|
|
354
687
|
export interface PhysicsEditResult2D<T = unknown> {
|
|
355
688
|
/** The builder's return value, with pending references resolved to live handles. */
|
|
@@ -368,16 +701,22 @@ export interface PhysicsEditOps2D {
|
|
|
368
701
|
replaceJoint(ref: PhysicsJointRef2D, joint: PhysicsJointInput2D, options?: { readonly required?: boolean }): PhysicsJointRef2D;
|
|
369
702
|
removeJoint(ref: PhysicsJointRef2D): void;
|
|
370
703
|
|
|
704
|
+
createFluid(fluid: PhysicsFluidInput2D, options?: { readonly required?: boolean }): PhysicsPendingFluidReference2D;
|
|
705
|
+
replaceFluid(ref: PhysicsFluidRef2D, fluid: PhysicsFluidInput2D, options?: { readonly required?: boolean }): PhysicsFluidRef2D;
|
|
706
|
+
removeFluid(ref: PhysicsFluidRef2D): void;
|
|
707
|
+
|
|
371
708
|
}
|
|
372
709
|
|
|
373
710
|
export interface OwnedPhysicsWorld2D {
|
|
374
711
|
step(): void;
|
|
375
|
-
setGravity(x:
|
|
712
|
+
setGravity(x: MetersPerSecondSquared, y: MetersPerSecondSquared): void;
|
|
376
713
|
edit<T = unknown>(build: (ops: PhysicsEditOps2D) => T): PhysicsEditResult2D<T>;
|
|
377
714
|
readBody(handle: PhysicsBodyHandle2D): PhysicsBody2D;
|
|
378
715
|
readJoint(handle: PhysicsJointHandle2D): PhysicsJointRecord2D;
|
|
716
|
+
readFluid(handle: PhysicsFluidHandle2D): PhysicsFluid2D;
|
|
379
717
|
resolveBody(id: number): PhysicsBodyHandle2D;
|
|
380
718
|
resolveJoint(id: number): PhysicsJointHandle2D;
|
|
719
|
+
resolveFluid(id: number): PhysicsFluidHandle2D;
|
|
381
720
|
latest(): PhysicsLatestOutputs2D;
|
|
382
721
|
capture(): Uint8Array;
|
|
383
722
|
digest(): bigint;
|
|
@@ -388,6 +727,7 @@ export interface OwnedPhysicsWorld2D {
|
|
|
388
727
|
releaseCheckpoint(checkpoint: PhysicsCheckpoint2D): void;
|
|
389
728
|
raycast(request: PhysicsRaycastQuery2D): readonly PhysicsCastHit2D[];
|
|
390
729
|
overlap(request: PhysicsOverlapQuery2D): readonly number[];
|
|
730
|
+
overlapContacts(request: PhysicsOverlapQuery2D): readonly PhysicsOverlapContact2D[];
|
|
391
731
|
shapeCast(request: PhysicsShapeCastQuery2D): readonly PhysicsCastHit2D[];
|
|
392
732
|
closestPoints(request: PhysicsClosestPointsQuery2D): readonly PhysicsClosestPointResult2D[];
|
|
393
733
|
info(): PhysicsWorldInfo2D;
|