@series-inc/rundot-syncplay 6.0.0-rc.6 → 6.0.0-rc.60
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 +174 -0
- package/bench/wreck-yard-sleeping-contacts.json +855 -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 +5 -0
- package/core/native/physics/abi.hpp +2 -0
- package/core/native/physics/capsule_triangle_native.inc +74 -17
- package/core/native/physics/certified_sum.hpp +218 -0
- package/core/native/physics/checkpoint_schema.hpp +413 -0
- package/core/native/physics/constraint_rows.cpp +18 -12
- package/core/native/physics/constraint_rows.hpp +4 -1
- package/core/native/physics/contact_material_store.cpp +791 -0
- package/core/native/physics/contact_material_store.hpp +281 -0
- package/core/native/physics/exact/exact-applied.hpp +57 -1
- package/core/native/physics/exact/word-core.hpp +1 -0
- package/core/native/physics/extended_abi.cpp +48 -0
- package/core/native/physics/extended_abi.hpp +31 -0
- package/core/native/physics/geometry_memory.hpp +435 -11
- package/core/native/physics/geometry_store.cpp +384 -28
- package/core/native/physics/geometry_store.hpp +49 -2
- package/core/native/physics/material_pose.hpp +628 -320
- package/core/native/physics/physics.cpp +6295 -756
- package/core/native/physics/physics.hpp +276 -2
- package/core/native/physics/surface_velocity.cpp +817 -13
- package/core/native/physics/surface_velocity.hpp +283 -67
- package/core/native/physics/surface_velocity_math.hpp +91 -0
- package/core/native/physics/topology.cpp +68 -0
- package/core/native/physics/topology.hpp +31 -1
- package/core/native/physics/world.cpp +6553 -557
- package/core/native/physics/world.hpp +1038 -21
- package/core/native/physics/world_abi.cpp +4549 -820
- package/core/native/physics/world_abi.hpp +543 -5
- package/core/native/physics/world_digest_visitor.hpp +331 -0
- package/core/native/physics/world_strong_digest.hpp +622 -0
- package/core/native/physics2d/ccd.cpp +137 -8
- package/core/native/physics2d/checkpoint_memory.hpp +349 -0
- package/core/native/physics2d/commands.cpp +163 -25
- package/core/native/physics2d/commands.hpp +2 -0
- package/core/native/physics2d/contour.cpp +325 -0
- package/core/native/physics2d/contour.hpp +143 -0
- package/core/native/physics2d/joints.cpp +14 -23
- package/core/native/physics2d/memory_private.hpp +125 -0
- package/core/native/physics2d/owned_abi.cpp +1351 -898
- package/core/native/physics2d/owned_abi.hpp +177 -44
- package/core/native/physics2d/physics2d.cpp +1133 -59
- package/core/native/physics2d/physics2d.hpp +86 -1
- package/core/native/physics2d/queries.cpp +1046 -77
- package/core/native/physics2d/queries.hpp +62 -4
- package/core/native/physics2d/world.cpp +982 -357
- package/core/native/physics2d/world.hpp +109 -11
- 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 +327 -154
- package/core/runtime.d.ts +208 -19
- package/core/scripts/build-native.mjs +17 -0
- package/core/scripts/build-wasm-physics.mjs +174 -22
- package/core/scripts/extended-physics-profile.mjs +11 -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 +583 -27
- package/core/src/kinetix-deterministic-stdlib.mjs +68 -0
- package/core/src/kinetix-owned-runtime-adapter.mjs +789 -0
- package/core/src/kinetix-runtime-adapter-utils.mjs +46 -3
- package/core/src/kinetix-runtime-contract.mjs +55 -9
- package/core/src/kinetix-runtime-identity.mjs +12 -1
- package/core/src/kinetix-state-report.mjs +36 -0
- package/core/src/physics/abi-constants.mjs +3 -2
- package/core/src/physics/buoyancy.d.mts +132 -59
- package/core/src/physics/distance.d.mts +160 -7
- package/core/src/physics/feature-api.d.mts +13 -585
- package/core/src/physics/gear.d.mts +544 -301
- package/core/src/physics/mass-properties.d.mts +114 -3
- package/core/src/physics/physics-profile-wasm-module.generated.mjs +49 -0
- package/core/src/physics/physics-wasm-module.generated.mjs +35 -6
- package/core/src/physics/powertrain.d.mts +256 -226
- package/core/src/physics/profile.d.mts +2 -0
- package/core/src/physics/profile.mjs +14 -0
- package/core/src/physics/pulley.d.mts +92 -349
- package/core/src/physics/rope.d.mts +230 -29
- package/core/src/physics/surface-velocity.d.mts +194 -196
- package/core/src/physics/surface-velocity.mjs +916 -118
- package/core/src/physics/voxel-cooking.d.mts +35 -19
- package/core/src/physics/voxel-cooking.mjs +66 -8
- package/core/src/physics/voxel-swept-quad.mjs +110 -0
- package/core/src/physics/wasm-instance.mjs +154 -26
- package/core/src/physics/world.d.mts +184 -0
- package/core/src/physics/world.mjs +2245 -270
- package/core/src/physics2d/body-state.mjs +45 -5
- package/core/src/physics2d/collision.d.mts +13 -11
- package/core/src/physics2d/collision.mjs +39 -3
- package/core/src/physics2d/contour-state.mjs +771 -0
- package/core/src/physics2d/feature-api.d.mts +207 -1
- package/core/src/physics2d/owned-queries.mjs +3 -1
- package/core/src/physics2d/owned-transport.mjs +245 -113
- package/core/src/physics2d/owned-world.mjs +202 -62
- package/core/src/physics2d/particle-fluid.d.mts +139 -30
- package/core/src/physics2d/particle-fluid.mjs +67 -31
- package/core/src/physics2d/physics2d-wasm-module.generated.mjs +25 -8
- package/core/src/physics2d/query-codec.mjs +40 -6
- package/core/src/physics2d/submerged-geometry.d.mts +35 -16
- 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 +170 -55
- package/core/units.d.ts +50 -0
- package/core/world.d.ts +237 -2
- package/dist/api-deprecations.generated.d.ts +24 -0
- package/dist/api-deprecations.generated.js +24 -0
- package/dist/authority-room.d.ts +224 -3
- package/dist/authority-room.js +1573 -71
- package/dist/browser.d.ts +11 -6
- package/dist/browser.js +6 -4
- package/dist/canonical.d.ts +12 -0
- package/dist/canonical.js +60 -3
- package/dist/checksum-policy.d.ts +10 -0
- package/dist/checksum-policy.js +14 -0
- package/dist/collider-preparation.d.ts +31 -0
- package/dist/collider-preparation.js +506 -0
- package/dist/compat/v5.d.ts +5 -1
- package/dist/compat/v5.js +52 -9
- package/dist/creator.d.ts +10 -6
- package/dist/creator.js +5 -3
- package/dist/dev-authority-room.js +17 -40
- package/dist/engine-runtime.js +5 -8
- package/dist/extensions/hub/airlock.d.ts +153 -0
- package/dist/extensions/hub/airlock.js +500 -0
- package/dist/extensions/hub/contracts.d.ts +369 -0
- package/dist/extensions/hub/contracts.js +106 -0
- package/dist/extensions/hub/exfil.d.ts +54 -0
- package/dist/extensions/hub/exfil.js +110 -0
- package/dist/extensions/hub/handoff.d.ts +84 -0
- package/dist/extensions/hub/handoff.js +161 -0
- package/dist/extensions/hub/index.d.ts +12 -0
- package/dist/extensions/hub/index.js +12 -0
- package/dist/extensions/hub/inventory.d.ts +86 -0
- package/dist/extensions/hub/inventory.js +288 -0
- package/dist/extensions/hub/party.d.ts +43 -0
- package/dist/extensions/hub/party.js +58 -0
- package/dist/extensions/hub/plugin.d.ts +23 -0
- package/dist/extensions/hub/plugin.js +37 -0
- package/dist/extensions/hub/settlement.d.ts +42 -0
- package/dist/extensions/hub/settlement.js +121 -0
- package/dist/game-byte-section.d.ts +36 -0
- package/dist/game-byte-section.js +350 -0
- package/dist/index.d.ts +21 -9
- package/dist/index.js +18 -5
- package/dist/input-authority.d.ts +18 -1
- package/dist/input-authority.js +181 -29
- package/dist/instant-replay.d.ts +27 -2
- package/dist/instant-replay.js +91 -16
- package/dist/lag-compensation3d.js +78 -21
- package/dist/match-log.d.ts +41 -5
- package/dist/match-log.js +95 -9
- package/dist/math.d.ts +4 -0
- package/dist/math.js +69 -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/modules/extraction.d.ts +148 -0
- package/dist/modules/extraction.js +344 -0
- package/dist/modules/physical-assembly.d.ts +154 -0
- package/dist/modules/physical-assembly.js +897 -0
- package/dist/modules/rts.js +1 -1
- package/dist/movement3d-common.d.ts +57 -0
- package/dist/movement3d-common.js +218 -0
- package/dist/movement3d-revision1.d.ts +2 -0
- package/dist/movement3d-revision1.js +973 -0
- package/dist/movement3d-revision3.d.ts +2 -0
- package/dist/movement3d-revision3.js +844 -0
- package/dist/movement3d.d.ts +106 -3
- package/dist/movement3d.js +1292 -456
- package/dist/navmesh.d.ts +32 -0
- package/dist/navmesh.js +237 -0
- package/dist/networked-client.d.ts +45 -1
- package/dist/networked-client.js +887 -185
- package/dist/node.d.ts +4 -2
- package/dist/node.js +3 -1
- package/dist/ownership-audit.d.ts +25 -0
- package/dist/ownership-audit.js +103 -0
- package/dist/physics/2d.d.ts +19 -4
- package/dist/physics/2d.js +31 -6
- package/dist/physics/3d/assembly-bridge.d.ts +19 -0
- package/dist/physics/3d/assembly-bridge.js +238 -0
- package/dist/physics/3d/profile.d.ts +2 -0
- package/dist/physics/3d/profile.js +2 -0
- package/dist/physics/3d.d.ts +984 -251
- package/dist/physics/3d.js +7502 -403
- package/dist/physics/contact-materials3d.d.ts +435 -0
- package/dist/physics/contact-materials3d.js +776 -0
- package/dist/physics/debug-overlay3d.d.ts +118 -0
- package/dist/physics/debug-overlay3d.js +566 -0
- 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 +56 -0
- package/dist/physics/installed-runtime3d.js +394 -0
- package/dist/physics/installed-state-commitment3d.d.ts +2 -0
- package/dist/physics/installed-state-commitment3d.js +24 -0
- package/dist/physics/portal-render3d.d.ts +328 -0
- package/dist/physics/portal-render3d.js +751 -0
- package/dist/physics/units.d.ts +103 -0
- package/dist/physics/units.js +142 -0
- package/dist/physics/vehicle-state2d.d.ts +104 -0
- package/dist/physics/vehicle-state2d.js +757 -0
- package/dist/physics/vehicle-state3d.d.ts +103 -0
- package/dist/physics/vehicle-state3d.js +1539 -0
- package/dist/physics/voxel-body-state.d.ts +61 -0
- package/dist/physics/voxel-body-state.js +410 -0
- package/dist/plugins/index.d.ts +27 -0
- package/dist/plugins/index.js +114 -0
- package/dist/plugins/types.d.ts +34 -0
- package/dist/plugins/types.js +5 -0
- package/dist/presentation-ik.d.ts +44 -0
- package/dist/presentation-ik.js +153 -0
- package/dist/r3f-render-adapter.d.ts +23 -1
- package/dist/r3f-render-adapter.js +17 -2
- package/dist/replay.d.ts +13 -0
- package/dist/replay.js +98 -70
- package/dist/rooms-config-keys.d.ts +1 -1
- package/dist/rooms-config-keys.js +1 -0
- package/dist/run-room-transport.d.ts +1 -0
- package/dist/run-room-transport.js +20 -1
- package/dist/runner.d.ts +30 -2
- package/dist/runner.js +491 -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 +5 -8
- package/dist/runtime-room-metadata.js +10 -15
- package/dist/runtime-session.d.ts +16 -1
- package/dist/runtime-session.js +317 -61
- 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/sdk-session.d.ts +1 -0
- package/dist/sdk-session.js +6 -0
- package/dist/seat-control.d.ts +148 -0
- package/dist/seat-control.js +543 -0
- package/dist/secret-authority.d.ts +19 -4
- package/dist/secret-authority.js +290 -36
- package/dist/secret-client.d.ts +2 -1
- package/dist/secret-client.js +73 -26
- package/dist/secret-config.d.ts +1 -1
- package/dist/secret-config.js +40 -93
- package/dist/secret-crypto.js +70 -36
- package/dist/secret-protocol.d.ts +3 -0
- package/dist/secret-protocol.js +14 -7
- package/dist/session-promotion.d.ts +19 -1
- package/dist/session-promotion.js +37 -6
- package/dist/session-snapshot.d.ts +19 -4
- package/dist/session-snapshot.js +75 -45
- package/dist/session-wire.d.ts +33 -1
- package/dist/session-wire.js +143 -36
- package/dist/sorted-free-id.d.ts +1 -0
- package/dist/sorted-free-id.js +38 -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 +123 -19
- 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 +27 -2
- package/dist/tools/static-checker.js +9 -2
- package/dist/types.d.ts +14 -0
- package/extensions/hub/package.json +1 -0
- package/hub/package.json +1 -0
- package/package.json +77 -6
- package/plugins/package.json +1 -0
package/README.md
CHANGED
|
@@ -6,6 +6,41 @@ and `/physics/3d`. Both physics APIs use the canonical C++ core compiled to
|
|
|
6
6
|
WASM. Syncplay owns inputs, prediction, confirmation, rollback policy, replay
|
|
7
7
|
logs, late join, secrets, and transport.
|
|
8
8
|
|
|
9
|
+
## Physics profiling
|
|
10
|
+
|
|
11
|
+
Normal physics initialization loads the production WASM artifact. Game builds
|
|
12
|
+
that use the normal entries do not include the named profiling artifact.
|
|
13
|
+
|
|
14
|
+
Profiling is an explicit build option. Register its loader before initialization:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { initPhysics3D } from '@series-inc/rundot-syncplay/physics/3d';
|
|
18
|
+
import { registerPhysicsProfileArtifact } from '@series-inc/rundot-syncplay/physics/3d/profile';
|
|
19
|
+
|
|
20
|
+
registerPhysicsProfileArtifact();
|
|
21
|
+
await initPhysics3D({ artifact: 'profile' });
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Migration: existing calls with `artifact: 'profile'` need the new import and
|
|
25
|
+
registration call. Registration is idempotent. Importing the entry alone does
|
|
26
|
+
not register the loader. Registration does not select or initialize an artifact.
|
|
27
|
+
The same registration works before low-level core initialization. It cannot
|
|
28
|
+
switch an initialized production instance to profiling.
|
|
29
|
+
|
|
30
|
+
The profiling entry keeps the named WASM file in the game build. Keep it out of
|
|
31
|
+
release imports to exclude that file. The npm package still includes both
|
|
32
|
+
artifacts. Profiling uses the same simulation source and digest rules.
|
|
33
|
+
|
|
34
|
+
## Dynamic seat control & player-keyed secrets
|
|
35
|
+
|
|
36
|
+
Syncplay supports deterministic dynamic seating across any valid simulation capacity X via `deterministic.seatPolicy`:
|
|
37
|
+
- Transitions S1 through S6 govern empty, bot, and human controller states.
|
|
38
|
+
- Policy fields include `recycleVacatedSeats`, `allowHumanClaimBot` (enabling human takeover of bot seats for S3), `onHumanLeave` (`'empty' | 'bot'`), and `initialBotSlots`. Retained owners can always reclaim their own seats without `allowHumanClaimBot`.
|
|
39
|
+
- Controller leases are authority-issued and room-scoped (`claimId`, `botLeaseId`, `controlEpoch`).
|
|
40
|
+
- Private secret holdings (cards, items, secret roles, and choices) are strictly bound to authenticated `playerId` and `claimId`.
|
|
41
|
+
- Unconsumed holdings are permanently revoked when a human releases a recyclable seat (`recycleVacatedSeats: true`).
|
|
42
|
+
- A successor player occupying a vacated seat never inherits prior items, secret values, or roles.
|
|
43
|
+
|
|
9
44
|
## Installation
|
|
10
45
|
|
|
11
46
|
Install the RUN SDK and Syncplay in the game project. Syncplay uses the
|
|
@@ -459,6 +494,44 @@ Call `initPhysics2D()` or `initPhysics3D()` before world creation. Create an
|
|
|
459
494
|
owned world with `createPhysicsWorld2D()` or `createPhysicsWorld3D()`. Each
|
|
460
495
|
world provides fixed stepping, atomic edits, retained queries, opaque native
|
|
461
496
|
checkpoints, portable checkpoint bytes, a state digest, and explicit disposal.
|
|
497
|
+
The 2D engine supports circle, box, capsule, polygon, segment, chain, piecewise
|
|
498
|
+
contour loops, and circular quadrant arcs with the free-side collision rule and
|
|
499
|
+
strict deterministic query tie-ordering.
|
|
500
|
+
|
|
501
|
+
Store logical body IDs in checkpointed game state. A hit has `bodyId`. A
|
|
502
|
+
contact has `bodyA` and `bodyB`. Keep an application `Map` from these `bigint`
|
|
503
|
+
IDs to entities. Each contact then uses `entities.get(contact.bodyA)` and
|
|
504
|
+
`entities.get(contact.bodyB)`. It requires no body-name scan.
|
|
505
|
+
|
|
506
|
+
Resolve a fresh handle with `world.resolveBody(id)` after a restore. Old
|
|
507
|
+
handles are stale. Transfer IDs as decimal strings if the game codec does not
|
|
508
|
+
support `bigint`. Convert them with `BigInt(text)`, never `Number(text)`.
|
|
509
|
+
Rebuild the lookup from the restored game state before processing contacts.
|
|
510
|
+
Physics checkpoints do not contain the application's entity table. Transfer
|
|
511
|
+
and restore both parts of the same frame.
|
|
512
|
+
|
|
513
|
+
### Grab servo revision 2
|
|
514
|
+
|
|
515
|
+
Set `behaviorRevision: 2` to use gravity compensation, target velocity,
|
|
516
|
+
angular damping, and the corrected local anchor. Revision 2 rotates the local
|
|
517
|
+
anchor with the body orientation. Existing calls use revision 1.
|
|
518
|
+
|
|
519
|
+
Use `createGrabServoState3D()` and `stepGrabServo3D()` for explicit game state.
|
|
520
|
+
Store the returned state with the physics checkpoint. The object wrapper
|
|
521
|
+
provides `capture()` and `restore()` for the same state. Restore both parts of
|
|
522
|
+
the same frame. The servo resolves the body ID after a physics restore.
|
|
523
|
+
|
|
524
|
+
Force and acceleration limits apply to the total force in revision 2.
|
|
525
|
+
This includes gravity compensation. Torque limits apply to total torque.
|
|
526
|
+
One scale applies to all three components. A limit can reduce compensation,
|
|
527
|
+
so the body can fall. The default force limit is 1000 N. A 150 kg body under
|
|
528
|
+
9.81 m/s² gravity requires more than this limit to hold its position.
|
|
529
|
+
Choose limits for the body's mass and gravity. A binding limit cannot promise
|
|
530
|
+
position holding. Revision 1 keeps its earlier acceleration-limit rule.
|
|
531
|
+
|
|
532
|
+
Include the helper revision in canonical session configuration and the game
|
|
533
|
+
deterministic version. Store targets, tuning, force limits, release state,
|
|
534
|
+
and body IDs in checkpointed game state.
|
|
462
535
|
|
|
463
536
|
The TypeScript facade does not contain a second solver. Both dimensions run in
|
|
464
537
|
the canonical C++ core compiled to WASM. The internal solver algorithm, state
|
|
@@ -475,3 +548,104 @@ the [3D guide](https://github.com/series-ai/venus/blob/develop/packages/sdk-docs
|
|
|
475
548
|
the [RC1 migration helper](https://github.com/series-ai/venus/blob/develop/packages/sdk-docs/rundot-developer-platform/api/SYNCPLAY-RC1-MIGRATION.md).
|
|
476
549
|
Physical-phone performance remains a release gate. Do not infer phone results
|
|
477
550
|
from desktop measurements.
|
|
551
|
+
|
|
552
|
+
Restore the physics world before you restore a grab servo state. Revision 2 accepts
|
|
553
|
+
an active state whose body was removed in the same tick. Its next step changes
|
|
554
|
+
the state to `released` with reason `body-removed`. That step applies no force.
|
|
555
|
+
`isBroken()` reads the current condition. It does not change the captured state.
|
|
556
|
+
|
|
557
|
+
Revision 1 keeps its body handle until you restore the servo state. A physics
|
|
558
|
+
restore makes the old handle stale. Restore both states before the next step.
|
|
559
|
+
|
|
560
|
+
### SI types in the next RC
|
|
561
|
+
|
|
562
|
+
The next RC requires SI constructors at typed physics call sites. Replace plain
|
|
563
|
+
numbers with the constructor for each quantity. Use meters for positions,
|
|
564
|
+
kilograms for mass, metersPerSecond for linear velocity, and newtons for force.
|
|
565
|
+
Use frameVelocity and frameGravity for frame quantities. Each constructor keeps
|
|
566
|
+
the bits of a finite input. It rejects NaN and infinity.
|
|
567
|
+
|
|
568
|
+
This change can produce TypeScript errors in existing games. Update those call
|
|
569
|
+
sites when you upgrade the SDK. Revision 1 helper behavior remains selected by
|
|
570
|
+
default. The revision 1 tests compare complete results with the previous RC.
|
|
571
|
+
|
|
572
|
+
Set `behaviorRevision: 3` to recover from contact penetration after a landing.
|
|
573
|
+
This revision includes slope clearance for dynamic supports. It keeps the
|
|
574
|
+
revision 1 result shape and uses required checksums by default. Revision 1
|
|
575
|
+
remains the default. Revision 2 keeps its support state and portal movement.
|
|
576
|
+
|
|
577
|
+
New helper behavior requires an explicit revision selection.
|
|
578
|
+
|
|
579
|
+
### Shape-preserving body changes
|
|
580
|
+
|
|
581
|
+
Use `world.setBodyTransform(idOrHandle, { position, orientation })` to change a pose.
|
|
582
|
+
Use `meters()` for each position component.
|
|
583
|
+
The world normalizes the quaternion.
|
|
584
|
+
The operation keeps the shape, mass, inertia, logical ID, and velocities.
|
|
585
|
+
An identical normalized pose preserves sleep and the mutation revision.
|
|
586
|
+
A changed pose wakes the affected dynamic joint group.
|
|
587
|
+
|
|
588
|
+
Use `world.setBodyLinearDamping(idOrHandle, factor)` to change linear damping.
|
|
589
|
+
The factor is the fraction of velocity kept per tick.
|
|
590
|
+
Its range is 0 through 1.
|
|
591
|
+
The operation preserves sleep.
|
|
592
|
+
Use `world.wakeBody(idOrHandle)` to wake a dynamic body without a velocity change.
|
|
593
|
+
Resolve a new handle after a checkpoint restore, or use the logical ID.
|
|
594
|
+
|
|
595
|
+
### Batch motion output
|
|
596
|
+
|
|
597
|
+
`world.writeBodyMotionInto(poses, velocities, ids, status)` returns the body count,
|
|
598
|
+
mutation `revision`, and `restoreEpoch`.
|
|
599
|
+
Use `Float64Array` for poses and velocities.
|
|
600
|
+
Use `BigUint64Array` for logical IDs.
|
|
601
|
+
Use `Uint8Array` for status.
|
|
602
|
+
The output orders bodies by ascending logical ID.
|
|
603
|
+
|
|
604
|
+
Each pose has seven values: x, y, z, qx, qy, qz, qw.
|
|
605
|
+
Each velocity has six values: vx, vy, vz, wx, wy, wz.
|
|
606
|
+
Positions use meters.
|
|
607
|
+
Linear velocities use meters per second.
|
|
608
|
+
Angular velocities use radians per second.
|
|
609
|
+
Quaternion components have no unit.
|
|
610
|
+
|
|
611
|
+
Status bits 0 and 1 contain the body kind: static 0, dynamic 1, or kinematic 2.
|
|
612
|
+
Bit 2 means trigger.
|
|
613
|
+
Bit 3 means sensor.
|
|
614
|
+
Bit 4 means sleeping.
|
|
615
|
+
Bit 5 means angular motion is enabled.
|
|
616
|
+
The operation checks all buffers before it writes a value.
|
|
617
|
+
It preserves the unused output suffix.
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
Engine RPM values use `turnsPerMinute(value)`.
|
|
621
|
+
The powertrain reverse-gear check takes `metersPerSecond(value)`.
|
|
622
|
+
These constructors preserve finite values and reject NaN and infinity.
|
|
623
|
+
|
|
624
|
+
The 2D particle emitter preserves a supplied particle ID.
|
|
625
|
+
An omitted ID or zero requests the next automatic ID.
|
|
626
|
+
A supplied ID must be unique and from 1 through 4294967294.
|
|
627
|
+
Particle records stay in increasing ID order.
|
|
628
|
+
|
|
629
|
+
`createVoxelBody3D` creates a native body and immutable voxel state.
|
|
630
|
+
Store the returned state in the captured game state.
|
|
631
|
+
`carveVoxelBody3D` stages a cut and publishes one body edit after cooking succeeds.
|
|
632
|
+
Use its returned state for the next cut.
|
|
633
|
+
`paintVoxelBody3D` changes material IDs and keeps the same collision children.
|
|
634
|
+
`hydrateVoxelBodyState3D` checks the stored partition against the restored native body.
|
|
635
|
+
It does not replace that partition with a full cook.
|
|
636
|
+
|
|
637
|
+
Body-level sphere, capsule, and swept-quad regions use body-local meters.
|
|
638
|
+
Box regions use integer cell indices.
|
|
639
|
+
The body API accounts for `originOffset` in SI regions.
|
|
640
|
+
Occupancy must contain only zero and one.
|
|
641
|
+
Each occupied cell keeps its initial mass when a cut removes other cells.
|
|
642
|
+
A cut preserves the velocity of retained material when the center of mass changes.
|
|
643
|
+
Locked velocity components stay zero.
|
|
644
|
+
|
|
645
|
+
A removed voxel state keeps only its body ID, format, revision, and removed status.
|
|
646
|
+
Hydration checks that its revision is positive and its body ID is absent.
|
|
647
|
+
This absence check does not prove which world first allocated the removed ID.
|
|
648
|
+
|
|
649
|
+
`voxelBodyDigest3D(state)` returns the cached SHA-256 content digest. Creation, edits, and hydration compute this digest once per immutable root. Repeated reads do not scan cells or cooked children. The digest includes the body ID, revision, dimensions, occupancy, materials, child IDs and descriptors, next ID, cell mass, origin offset, and child limit. Hydrate a copied or decoded root before you read its digest or use it in carve, paint, or remove. These operations accept only roots registered by this module instance. If two package copies load, hydrate the root in the receiving copy.
|
|
650
|
+
|
|
651
|
+
Pass the current voxel root to each edit. Native validation detects differences in geometry and mass. It cannot detect a stale root that differs only in paint. Keep the returned root in canonical game state. Use that root for each later cut, paint, or removal.
|