@series-inc/rundot-syncplay 5.26.0 → 5.27.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/core/native/physics/physics.cpp +129 -3
- package/core/native/physics/physics.hpp +1 -1
- package/core/physics.d.ts +1 -0
- package/core/scripts/build-wasm-physics.mjs +1 -1
- package/core/src/physics/index.mjs +20 -9
- package/core/src/physics/physics-wasm-module.generated.mjs +4 -4
- package/dist/browser.d.ts +4 -4
- package/dist/browser.js +2 -2
- package/dist/creator.d.ts +4 -4
- package/dist/creator.js +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/physics3d-voxel.d.ts +23 -1
- package/dist/physics3d-voxel.js +138 -0
- package/dist/physics3d.d.ts +26 -0
- package/dist/physics3d.js +187 -1
- package/package.json +2 -2
package/dist/browser.d.ts
CHANGED
|
@@ -24,8 +24,8 @@ export { createNetworkedSyncplayClient, prepareNetworkedSyncplayTransport } from
|
|
|
24
24
|
export { createSyncplayRunner } from './runner.js';
|
|
25
25
|
export { fbm2D, hash2, hashUint32, valueNoise1D, valueNoise2D } from './noise.js';
|
|
26
26
|
export { circleCastDeterministicPhysics2D, createDeterministicPhysicsWorld2D, nearestDeterministicPhysicsHit2D, queryDeterministicPhysicsAabb2D, queryDeterministicPhysicsShapeOverlap2D, raycastAllDeterministicPhysics2D, raycastDeterministicPhysics2D, stepDeterministicPhysicsWorld2D } from './physics2d.js';
|
|
27
|
-
export { applyDeterministicImpulse3D, applyDeterministicImpulses3D, applyDeterministicWorldEdit3D, contactDetailsDeterministicPhysics3D, createDeterministicPhysicsWorld3D, createTrustedDeterministicPhysicsWorld3D, deriveInverseInertia, deterministicPhysicsBodyById3D, deterministicPhysicsCallback3D, overlapDeterministicPhysics3D, raycastDeterministicPhysics3D, raycastDeterministicPhysics3DDetailed, runDeterministicPhysics3DStress, setDeterministicBodyVelocity3D, shapeCastDeterministicPhysics3D, shapeCastDeterministicPhysics3DDetailed, stepDeterministicPhysicsWorld3D } from './physics3d.js';
|
|
28
|
-
export { cookDeterministicVoxelChunkCollider3D } from './physics3d-voxel.js';
|
|
27
|
+
export { applyDeterministicImpulse3D, applyDeterministicImpulses3D, applyDeterministicWorldEdit3D, contactDetailsDeterministicPhysics3D, createDeterministicPhysicsWorld3D, createTrustedDeterministicPhysicsWorld3D, deriveInverseInertia, deterministicPhysicsBodyById3D, deterministicPhysicsCallback3D, overlapDeterministicPhysics3D, raycastDeterministicPhysics3D, raycastDeterministicPhysics3DDetailed, runDeterministicPhysics3DStress, setDeterministicBodyVelocity3D, setDeterministicKinematicPoses3D, shapeCastDeterministicPhysics3D, shapeCastDeterministicPhysics3DDetailed, stepDeterministicPhysicsWorld3D } from './physics3d.js';
|
|
28
|
+
export { cookDeterministicVoxelChunkCollider3D, raycastDeterministicVoxelChunk3D } from './physics3d-voxel.js';
|
|
29
29
|
export { cylinderHullVertices } from './physics3d-hull.js';
|
|
30
30
|
export { createDeterministicCosmeticPhysicsWorld3D, setDeterministicCosmeticPhysicsAuthoritativeBodyProxies3D, stepDeterministicCosmeticPhysicsWorld3D } from './cosmetic-physics3d.js';
|
|
31
31
|
export { stepDeterministicVehicle3D } from './physics3d-vehicle.js';
|
|
@@ -65,8 +65,8 @@ export type { CookedDeterministicNavmesh, DeterministicNavmeshAgent, Determinist
|
|
|
65
65
|
export type { ConfirmedSyncplayPresentationFrame, KinetixRuntimeFactory, NetworkedClientTransport, NetworkedSyncplayClient, NetworkedSyncplayClientInputDelayOptions, NetworkedSyncplayClientNetStats, NetworkedSyncplayClientOptions, NetworkedSyncplayClientPacingOptions, NetworkedSyncplayPreparationOptions, NetworkedSyncplaySessionDescriptor, NetworkedSyncplaySlotPresence, PreparedNetworkedSyncplayTransport, SyncplayPredictionMode, SyncplayRemoteInputPrediction } from './networked-client.js';
|
|
66
66
|
export type { SyncplayRunner, SyncplayRunnerConfig, SyncplayRunnerConnectionEvent, SyncplayRunnerOccupancy, SyncplayRunnerOfflineOptions, SyncplayRunnerPresentation, SyncplayRunnerSnapshot, SyncplayRunnerStatus, SyncplayRunnerTransport } from './runner.js';
|
|
67
67
|
export type { DeterministicBodyKind, DeterministicContactEvent2D, DeterministicContactEventType, DeterministicPhysicsAabbQuery2D, DeterministicPhysicsActivePair2D, DeterministicPhysicsBody2D, DeterministicPhysicsCircleCastQuery2D, DeterministicPhysicsConstraint2D, DeterministicPhysicsHit2D, DeterministicPhysicsQueryOptions2D, DeterministicPhysicsRaycastQuery2D, DeterministicPhysicsShape2D, DeterministicPhysicsShapeOverlapQuery2D, DeterministicPhysicsStepOptions2D, DeterministicPhysicsStepResult2D, DeterministicPhysicsWorld2D } from './physics2d.js';
|
|
68
|
-
export type { DeterministicContactCacheEntry3D, DeterministicJointCacheEntry3D, DeterministicPhysicsActivePair3D, DeterministicPhysicsAxisLock3D, DeterministicPhysicsBody3D, DeterministicPhysicsCallbackMask3D, DeterministicPhysicsCompoundChild3D, DeterministicPhysicsCompoundChildShape3D, DeterministicPhysicsConstraint3D, DeterministicPhysicsContactDetail3D, DeterministicPhysicsContactEvent3D, DeterministicPhysicsDetailedHit3D, DeterministicPhysicsHit3D, DeterministicPhysicsHullShape3D, DeterministicPhysicsImpulseApplication3D, DeterministicPhysicsOverlapQuery3D, DeterministicPhysicsPrimitiveShape3D, DeterministicPhysicsQuaternion3D, DeterministicPhysicsQueryOptions3D, DeterministicPhysicsRaycastQuery3D, DeterministicPhysicsScheduledQuery3D, DeterministicPhysicsShape3D, DeterministicPhysicsShapeCastQuery3D, DeterministicPhysicsStepResult3D, DeterministicPhysicsVec3, DeterministicPhysicsWorld3D, DeterministicPhysicsWorldEdit3D } from './physics3d.js';
|
|
69
|
-
export type { DeterministicVoxelChunk3D, DeterministicVoxelCompoundShape3D } from './physics3d-voxel.js';
|
|
68
|
+
export type { DeterministicContactCacheEntry3D, DeterministicJointCacheEntry3D, DeterministicKinematicPose3D, DeterministicPhysicsActivePair3D, DeterministicPhysicsAxisLock3D, DeterministicPhysicsBody3D, DeterministicPhysicsCallbackMask3D, DeterministicPhysicsCompoundChild3D, DeterministicPhysicsCompoundChildShape3D, DeterministicPhysicsConstraint3D, DeterministicPhysicsContactDetail3D, DeterministicPhysicsContactEvent3D, DeterministicPhysicsDetailedHit3D, DeterministicPhysicsHit3D, DeterministicPhysicsHullShape3D, DeterministicPhysicsImpulseApplication3D, DeterministicPhysicsOverlapQuery3D, DeterministicPhysicsPrimitiveShape3D, DeterministicPhysicsQuaternion3D, DeterministicPhysicsQueryOptions3D, DeterministicPhysicsRaycastQuery3D, DeterministicPhysicsScheduledQuery3D, DeterministicPhysicsShape3D, DeterministicPhysicsShapeCastQuery3D, DeterministicPhysicsStepResult3D, DeterministicPhysicsVec3, DeterministicPhysicsWorld3D, DeterministicPhysicsWorldEdit3D } from './physics3d.js';
|
|
69
|
+
export type { DeterministicVoxelChunk3D, DeterministicVoxelCompoundShape3D, DeterministicVoxelRayHit3D } from './physics3d-voxel.js';
|
|
70
70
|
export type { DeterministicAuthoritativeBodyProxy3D, DeterministicCosmeticPhysicsBody3D, DeterministicCosmeticPhysicsStepOptions3D, DeterministicCosmeticPhysicsStepResult3D, DeterministicCosmeticPhysicsWorld3D } from './cosmetic-physics3d.js';
|
|
71
71
|
export type { DeterministicPhysicsJoint3D } from './physics3d-joints.js';
|
|
72
72
|
export type { DeterministicVehicle3D, DeterministicVehicleImpulse3D, DeterministicVehicleInput3D, DeterministicVehicleStepOptions3D, DeterministicVehicleStepResult3D, DeterministicVehicleWheel3D, DeterministicVehicleWheelTelemetry3D } from './physics3d-vehicle.js';
|
package/dist/browser.js
CHANGED
|
@@ -25,8 +25,8 @@ export { createNetworkedSyncplayClient, prepareNetworkedSyncplayTransport } from
|
|
|
25
25
|
export { createSyncplayRunner } from './runner.js';
|
|
26
26
|
export { fbm2D, hash2, hashUint32, valueNoise1D, valueNoise2D } from './noise.js';
|
|
27
27
|
export { circleCastDeterministicPhysics2D, createDeterministicPhysicsWorld2D, nearestDeterministicPhysicsHit2D, queryDeterministicPhysicsAabb2D, queryDeterministicPhysicsShapeOverlap2D, raycastAllDeterministicPhysics2D, raycastDeterministicPhysics2D, stepDeterministicPhysicsWorld2D } from './physics2d.js';
|
|
28
|
-
export { applyDeterministicImpulse3D, applyDeterministicImpulses3D, applyDeterministicWorldEdit3D, contactDetailsDeterministicPhysics3D, createDeterministicPhysicsWorld3D, createTrustedDeterministicPhysicsWorld3D, deriveInverseInertia, deterministicPhysicsBodyById3D, deterministicPhysicsCallback3D, overlapDeterministicPhysics3D, raycastDeterministicPhysics3D, raycastDeterministicPhysics3DDetailed, runDeterministicPhysics3DStress, setDeterministicBodyVelocity3D, shapeCastDeterministicPhysics3D, shapeCastDeterministicPhysics3DDetailed, stepDeterministicPhysicsWorld3D } from './physics3d.js';
|
|
29
|
-
export { cookDeterministicVoxelChunkCollider3D } from './physics3d-voxel.js';
|
|
28
|
+
export { applyDeterministicImpulse3D, applyDeterministicImpulses3D, applyDeterministicWorldEdit3D, contactDetailsDeterministicPhysics3D, createDeterministicPhysicsWorld3D, createTrustedDeterministicPhysicsWorld3D, deriveInverseInertia, deterministicPhysicsBodyById3D, deterministicPhysicsCallback3D, overlapDeterministicPhysics3D, raycastDeterministicPhysics3D, raycastDeterministicPhysics3DDetailed, runDeterministicPhysics3DStress, setDeterministicBodyVelocity3D, setDeterministicKinematicPoses3D, shapeCastDeterministicPhysics3D, shapeCastDeterministicPhysics3DDetailed, stepDeterministicPhysicsWorld3D } from './physics3d.js';
|
|
29
|
+
export { cookDeterministicVoxelChunkCollider3D, raycastDeterministicVoxelChunk3D } from './physics3d-voxel.js';
|
|
30
30
|
export { cylinderHullVertices } from './physics3d-hull.js';
|
|
31
31
|
export { createDeterministicCosmeticPhysicsWorld3D, setDeterministicCosmeticPhysicsAuthoritativeBodyProxies3D, stepDeterministicCosmeticPhysicsWorld3D } from './cosmetic-physics3d.js';
|
|
32
32
|
export { stepDeterministicVehicle3D } from './physics3d-vehicle.js';
|
package/dist/creator.d.ts
CHANGED
|
@@ -12,12 +12,12 @@ export type { RecordedChecksum, RecordedCommandFrame, RecordedDebugEvent, Record
|
|
|
12
12
|
export type { ReplayRuntimeFactory, ReplayVerificationConfig, ReplayVerificationExecution } from './replay.js';
|
|
13
13
|
export type { SyncplaySession, SyncplaySessionPolicy } from './sdk-session.js';
|
|
14
14
|
export type { InstantReplayInputFrame, InstantReplayResult, InstantReplayRunner, InstantReplayRunnerOptions, InstantReplayRunOptions, RunInstantReplayOptions, } from './instant-replay.js';
|
|
15
|
-
export { applyDeterministicImpulse3D, applyDeterministicImpulses3D, applyDeterministicWorldEdit3D, contactDetailsDeterministicPhysics3D, createDeterministicPhysicsWorld3D, deriveInverseInertia, deterministicPhysicsBodyById3D, deterministicPhysicsCallback3D, overlapDeterministicPhysics3D, raycastDeterministicPhysics3D, raycastDeterministicPhysics3DDetailed, runDeterministicPhysics3DStress, setDeterministicBodyVelocity3D, shapeCastDeterministicPhysics3D, shapeCastDeterministicPhysics3DDetailed, stepDeterministicPhysicsWorld3D, } from './physics3d.js';
|
|
16
|
-
export { cookDeterministicVoxelChunkCollider3D } from './physics3d-voxel.js';
|
|
15
|
+
export { applyDeterministicImpulse3D, applyDeterministicImpulses3D, applyDeterministicWorldEdit3D, contactDetailsDeterministicPhysics3D, createDeterministicPhysicsWorld3D, deriveInverseInertia, deterministicPhysicsBodyById3D, deterministicPhysicsCallback3D, overlapDeterministicPhysics3D, raycastDeterministicPhysics3D, raycastDeterministicPhysics3DDetailed, runDeterministicPhysics3DStress, setDeterministicBodyVelocity3D, setDeterministicKinematicPoses3D, shapeCastDeterministicPhysics3D, shapeCastDeterministicPhysics3DDetailed, stepDeterministicPhysicsWorld3D, } from './physics3d.js';
|
|
16
|
+
export { cookDeterministicVoxelChunkCollider3D, raycastDeterministicVoxelChunk3D } from './physics3d-voxel.js';
|
|
17
17
|
export { cylinderHullVertices } from './physics3d-hull.js';
|
|
18
18
|
export { stepDeterministicVehicle3D } from './physics3d-vehicle.js';
|
|
19
|
-
export type { DeterministicContactCacheEntry3D, DeterministicJointCacheEntry3D, DeterministicPhysicsActivePair3D, DeterministicPhysicsAxisLock3D, DeterministicPhysicsBody3D, DeterministicPhysicsCallbackMask3D, DeterministicPhysicsCompoundChild3D, DeterministicPhysicsCompoundChildShape3D, DeterministicPhysicsConstraint3D, DeterministicPhysicsContactDetail3D, DeterministicPhysicsContactEvent3D, DeterministicPhysicsDetailedHit3D, DeterministicPhysicsHit3D, DeterministicPhysicsHullShape3D, DeterministicPhysicsImpulseApplication3D, DeterministicPhysicsOverlapQuery3D, DeterministicPhysicsPrimitiveShape3D, DeterministicPhysicsQuaternion3D, DeterministicPhysicsQueryOptions3D, DeterministicPhysicsRaycastQuery3D, DeterministicPhysicsScheduledQuery3D, DeterministicPhysicsShape3D, DeterministicPhysicsShapeCastQuery3D, DeterministicPhysicsStepResult3D, DeterministicPhysicsVec3, DeterministicPhysicsWorld3D, DeterministicPhysicsWorldEdit3D, } from './physics3d.js';
|
|
20
|
-
export type { DeterministicVoxelChunk3D, DeterministicVoxelCompoundShape3D } from './physics3d-voxel.js';
|
|
19
|
+
export type { DeterministicContactCacheEntry3D, DeterministicJointCacheEntry3D, DeterministicKinematicPose3D, DeterministicPhysicsActivePair3D, DeterministicPhysicsAxisLock3D, DeterministicPhysicsBody3D, DeterministicPhysicsCallbackMask3D, DeterministicPhysicsCompoundChild3D, DeterministicPhysicsCompoundChildShape3D, DeterministicPhysicsConstraint3D, DeterministicPhysicsContactDetail3D, DeterministicPhysicsContactEvent3D, DeterministicPhysicsDetailedHit3D, DeterministicPhysicsHit3D, DeterministicPhysicsHullShape3D, DeterministicPhysicsImpulseApplication3D, DeterministicPhysicsOverlapQuery3D, DeterministicPhysicsPrimitiveShape3D, DeterministicPhysicsQuaternion3D, DeterministicPhysicsQueryOptions3D, DeterministicPhysicsRaycastQuery3D, DeterministicPhysicsScheduledQuery3D, DeterministicPhysicsShape3D, DeterministicPhysicsShapeCastQuery3D, DeterministicPhysicsStepResult3D, DeterministicPhysicsVec3, DeterministicPhysicsWorld3D, DeterministicPhysicsWorldEdit3D, } from './physics3d.js';
|
|
20
|
+
export type { DeterministicVoxelChunk3D, DeterministicVoxelCompoundShape3D, DeterministicVoxelRayHit3D } from './physics3d-voxel.js';
|
|
21
21
|
export type { DeterministicPhysicsJoint3D } from './physics3d-joints.js';
|
|
22
22
|
export type { DeterministicVehicle3D, DeterministicVehicleImpulse3D, DeterministicVehicleInput3D, DeterministicVehicleStepOptions3D, DeterministicVehicleStepResult3D, DeterministicVehicleWheel3D, DeterministicVehicleWheelTelemetry3D, } from './physics3d-vehicle.js';
|
|
23
23
|
export type { DeterministicPhysicsMaterial } from './deterministic-primitives.js';
|
package/dist/creator.js
CHANGED
|
@@ -9,7 +9,7 @@ export { runSyncplaySynctest } from './synctest.js';
|
|
|
9
9
|
// create/step/edit, impulses, queries, vehicles, and voxel-chunk collider
|
|
10
10
|
// cooking. Cosmetic physics, KCC (movement3d), and the destruction-cert runner
|
|
11
11
|
// stay off it — the first two are not requested, the third reads wall clock.
|
|
12
|
-
export { applyDeterministicImpulse3D, applyDeterministicImpulses3D, applyDeterministicWorldEdit3D, contactDetailsDeterministicPhysics3D, createDeterministicPhysicsWorld3D, deriveInverseInertia, deterministicPhysicsBodyById3D, deterministicPhysicsCallback3D, overlapDeterministicPhysics3D, raycastDeterministicPhysics3D, raycastDeterministicPhysics3DDetailed, runDeterministicPhysics3DStress, setDeterministicBodyVelocity3D, shapeCastDeterministicPhysics3D, shapeCastDeterministicPhysics3DDetailed, stepDeterministicPhysicsWorld3D, } from './physics3d.js';
|
|
13
|
-
export { cookDeterministicVoxelChunkCollider3D } from './physics3d-voxel.js';
|
|
12
|
+
export { applyDeterministicImpulse3D, applyDeterministicImpulses3D, applyDeterministicWorldEdit3D, contactDetailsDeterministicPhysics3D, createDeterministicPhysicsWorld3D, deriveInverseInertia, deterministicPhysicsBodyById3D, deterministicPhysicsCallback3D, overlapDeterministicPhysics3D, raycastDeterministicPhysics3D, raycastDeterministicPhysics3DDetailed, runDeterministicPhysics3DStress, setDeterministicBodyVelocity3D, setDeterministicKinematicPoses3D, shapeCastDeterministicPhysics3D, shapeCastDeterministicPhysics3DDetailed, stepDeterministicPhysicsWorld3D, } from './physics3d.js';
|
|
13
|
+
export { cookDeterministicVoxelChunkCollider3D, raycastDeterministicVoxelChunk3D } from './physics3d-voxel.js';
|
|
14
14
|
export { cylinderHullVertices } from './physics3d-hull.js';
|
|
15
15
|
export { stepDeterministicVehicle3D } from './physics3d-vehicle.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -27,8 +27,8 @@ export { createNetworkedSyncplayClient, prepareNetworkedSyncplayTransport } from
|
|
|
27
27
|
export { createSyncplayRunner } from './runner.js';
|
|
28
28
|
export { fbm2D, hash2, hashUint32, valueNoise1D, valueNoise2D } from './noise.js';
|
|
29
29
|
export { circleCastDeterministicPhysics2D, createDeterministicPhysicsWorld2D, nearestDeterministicPhysicsHit2D, queryDeterministicPhysicsAabb2D, queryDeterministicPhysicsShapeOverlap2D, raycastAllDeterministicPhysics2D, raycastDeterministicPhysics2D, stepDeterministicPhysicsWorld2D } from './physics2d.js';
|
|
30
|
-
export { applyDeterministicImpulse3D, applyDeterministicImpulses3D, applyDeterministicWorldEdit3D, contactDetailsDeterministicPhysics3D, createDeterministicPhysicsWorld3D, createTrustedDeterministicPhysicsWorld3D, deriveInverseInertia, deterministicPhysicsBodyById3D, deterministicPhysicsCallback3D, overlapDeterministicPhysics3D, raycastDeterministicPhysics3D, raycastDeterministicPhysics3DDetailed, runDeterministicPhysics3DStress, setDeterministicBodyVelocity3D, shapeCastDeterministicPhysics3D, shapeCastDeterministicPhysics3DDetailed, stepDeterministicPhysicsWorld3D } from './physics3d.js';
|
|
31
|
-
export { cookDeterministicVoxelChunkCollider3D } from './physics3d-voxel.js';
|
|
30
|
+
export { applyDeterministicImpulse3D, applyDeterministicImpulses3D, applyDeterministicWorldEdit3D, contactDetailsDeterministicPhysics3D, createDeterministicPhysicsWorld3D, createTrustedDeterministicPhysicsWorld3D, deriveInverseInertia, deterministicPhysicsBodyById3D, deterministicPhysicsCallback3D, overlapDeterministicPhysics3D, raycastDeterministicPhysics3D, raycastDeterministicPhysics3DDetailed, runDeterministicPhysics3DStress, setDeterministicBodyVelocity3D, setDeterministicKinematicPoses3D, shapeCastDeterministicPhysics3D, shapeCastDeterministicPhysics3DDetailed, stepDeterministicPhysicsWorld3D } from './physics3d.js';
|
|
31
|
+
export { cookDeterministicVoxelChunkCollider3D, raycastDeterministicVoxelChunk3D } from './physics3d-voxel.js';
|
|
32
32
|
export { cylinderHullVertices } from './physics3d-hull.js';
|
|
33
33
|
export { runDeterministicPhysics3DDestructionCert } from './physics3d-destruction-cert.js';
|
|
34
34
|
export { createDeterministicCosmeticPhysicsWorld3D, setDeterministicCosmeticPhysicsAuthoritativeBodyProxies3D, stepDeterministicCosmeticPhysicsWorld3D } from './cosmetic-physics3d.js';
|
|
@@ -77,8 +77,8 @@ export type { CookedDeterministicNavmesh, DeterministicNavmeshAgent, Determinist
|
|
|
77
77
|
export type { ConfirmedSyncplayPresentationFrame, KinetixRuntimeFactory, NetworkedClientTransport, NetworkedSyncplayClient, NetworkedSyncplayClientInputDelayOptions, NetworkedSyncplayClientNetStats, NetworkedSyncplayClientOptions, NetworkedSyncplayClientPacingOptions, NetworkedSyncplayPreparationOptions, NetworkedSyncplaySessionDescriptor, PreparedNetworkedSyncplayTransport, SyncplayPredictionMode, SyncplayRemoteInputPrediction } from './networked-client.js';
|
|
78
78
|
export type { SyncplayRunner, SyncplayRunnerConfig, SyncplayRunnerConnectionEvent, SyncplayRunnerOccupancy, SyncplayRunnerOfflineOptions, SyncplayRunnerPresentation, SyncplayRunnerSnapshot, SyncplayRunnerStatus, SyncplayRunnerTransport } from './runner.js';
|
|
79
79
|
export type { DeterministicBodyKind, DeterministicContactEvent2D, DeterministicContactEventType, DeterministicPhysicsAabbQuery2D, DeterministicPhysicsBody2D, DeterministicPhysicsCircleCastQuery2D, DeterministicPhysicsConstraint2D, DeterministicPhysicsHit2D, DeterministicPhysicsQueryOptions2D, DeterministicPhysicsRaycastQuery2D, DeterministicPhysicsShape2D, DeterministicPhysicsShapeOverlapQuery2D, DeterministicPhysicsStepOptions2D, DeterministicPhysicsStepResult2D, DeterministicPhysicsWorld2D } from './physics2d.js';
|
|
80
|
-
export type { DeterministicContactCacheEntry3D, DeterministicJointCacheEntry3D, DeterministicPhysicsActivePair3D, DeterministicPhysicsAxisLock3D, DeterministicPhysicsBody3D, DeterministicPhysicsCallbackMask3D, DeterministicPhysicsCompoundChild3D, DeterministicPhysicsCompoundChildShape3D, DeterministicPhysicsConstraint3D, DeterministicPhysicsContactDetail3D, DeterministicPhysicsContactEvent3D, DeterministicPhysicsDetailedHit3D, DeterministicPhysicsHit3D, DeterministicPhysicsHullShape3D, DeterministicPhysicsImpulseApplication3D, DeterministicPhysicsOverlapQuery3D, DeterministicPhysicsPrimitiveShape3D, DeterministicPhysicsQuaternion3D, DeterministicPhysicsQueryOptions3D, DeterministicPhysicsRaycastQuery3D, DeterministicPhysicsScheduledQuery3D, DeterministicPhysicsShape3D, DeterministicPhysicsShapeCastQuery3D, DeterministicPhysicsStepResult3D, DeterministicPhysicsVec3, DeterministicPhysicsWorld3D, DeterministicPhysicsWorldEdit3D } from './physics3d.js';
|
|
81
|
-
export type { DeterministicVoxelChunk3D, DeterministicVoxelCompoundShape3D } from './physics3d-voxel.js';
|
|
80
|
+
export type { DeterministicContactCacheEntry3D, DeterministicJointCacheEntry3D, DeterministicKinematicPose3D, DeterministicPhysicsActivePair3D, DeterministicPhysicsAxisLock3D, DeterministicPhysicsBody3D, DeterministicPhysicsCallbackMask3D, DeterministicPhysicsCompoundChild3D, DeterministicPhysicsCompoundChildShape3D, DeterministicPhysicsConstraint3D, DeterministicPhysicsContactDetail3D, DeterministicPhysicsContactEvent3D, DeterministicPhysicsDetailedHit3D, DeterministicPhysicsHit3D, DeterministicPhysicsHullShape3D, DeterministicPhysicsImpulseApplication3D, DeterministicPhysicsOverlapQuery3D, DeterministicPhysicsPrimitiveShape3D, DeterministicPhysicsQuaternion3D, DeterministicPhysicsQueryOptions3D, DeterministicPhysicsRaycastQuery3D, DeterministicPhysicsScheduledQuery3D, DeterministicPhysicsShape3D, DeterministicPhysicsShapeCastQuery3D, DeterministicPhysicsStepResult3D, DeterministicPhysicsVec3, DeterministicPhysicsWorld3D, DeterministicPhysicsWorldEdit3D } from './physics3d.js';
|
|
81
|
+
export type { DeterministicVoxelChunk3D, DeterministicVoxelCompoundShape3D, DeterministicVoxelRayHit3D } from './physics3d-voxel.js';
|
|
82
82
|
export type { DeterministicDestructionCertOptions, DeterministicDestructionCertResult } from './physics3d-destruction-cert.js';
|
|
83
83
|
export type { DeterministicAuthoritativeBodyProxy3D, DeterministicCosmeticPhysicsBody3D, DeterministicCosmeticPhysicsStepOptions3D, DeterministicCosmeticPhysicsStepResult3D, DeterministicCosmeticPhysicsWorld3D } from './cosmetic-physics3d.js';
|
|
84
84
|
export type { DeterministicPhysicsJoint3D } from './physics3d-joints.js';
|
package/dist/index.js
CHANGED
|
@@ -28,8 +28,8 @@ export { createNetworkedSyncplayClient, prepareNetworkedSyncplayTransport } from
|
|
|
28
28
|
export { createSyncplayRunner } from './runner.js';
|
|
29
29
|
export { fbm2D, hash2, hashUint32, valueNoise1D, valueNoise2D } from './noise.js';
|
|
30
30
|
export { circleCastDeterministicPhysics2D, createDeterministicPhysicsWorld2D, nearestDeterministicPhysicsHit2D, queryDeterministicPhysicsAabb2D, queryDeterministicPhysicsShapeOverlap2D, raycastAllDeterministicPhysics2D, raycastDeterministicPhysics2D, stepDeterministicPhysicsWorld2D } from './physics2d.js';
|
|
31
|
-
export { applyDeterministicImpulse3D, applyDeterministicImpulses3D, applyDeterministicWorldEdit3D, contactDetailsDeterministicPhysics3D, createDeterministicPhysicsWorld3D, createTrustedDeterministicPhysicsWorld3D, deriveInverseInertia, deterministicPhysicsBodyById3D, deterministicPhysicsCallback3D, overlapDeterministicPhysics3D, raycastDeterministicPhysics3D, raycastDeterministicPhysics3DDetailed, runDeterministicPhysics3DStress, setDeterministicBodyVelocity3D, shapeCastDeterministicPhysics3D, shapeCastDeterministicPhysics3DDetailed, stepDeterministicPhysicsWorld3D } from './physics3d.js';
|
|
32
|
-
export { cookDeterministicVoxelChunkCollider3D } from './physics3d-voxel.js';
|
|
31
|
+
export { applyDeterministicImpulse3D, applyDeterministicImpulses3D, applyDeterministicWorldEdit3D, contactDetailsDeterministicPhysics3D, createDeterministicPhysicsWorld3D, createTrustedDeterministicPhysicsWorld3D, deriveInverseInertia, deterministicPhysicsBodyById3D, deterministicPhysicsCallback3D, overlapDeterministicPhysics3D, raycastDeterministicPhysics3D, raycastDeterministicPhysics3DDetailed, runDeterministicPhysics3DStress, setDeterministicBodyVelocity3D, setDeterministicKinematicPoses3D, shapeCastDeterministicPhysics3D, shapeCastDeterministicPhysics3DDetailed, stepDeterministicPhysicsWorld3D } from './physics3d.js';
|
|
32
|
+
export { cookDeterministicVoxelChunkCollider3D, raycastDeterministicVoxelChunk3D } from './physics3d-voxel.js';
|
|
33
33
|
export { cylinderHullVertices } from './physics3d-hull.js';
|
|
34
34
|
export { runDeterministicPhysics3DDestructionCert } from './physics3d-destruction-cert.js';
|
|
35
35
|
export { createDeterministicCosmeticPhysicsWorld3D, setDeterministicCosmeticPhysicsAuthoritativeBodyProxies3D, stepDeterministicCosmeticPhysicsWorld3D } from './cosmetic-physics3d.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeterministicPhysicsShape3D } from './physics3d.js';
|
|
1
|
+
import type { DeterministicPhysicsRaycastQuery3D, DeterministicPhysicsShape3D } from './physics3d.js';
|
|
2
2
|
export interface DeterministicVoxelChunk3D {
|
|
3
3
|
readonly dimX: number;
|
|
4
4
|
readonly dimY: number;
|
|
@@ -8,9 +8,31 @@ export interface DeterministicVoxelChunk3D {
|
|
|
8
8
|
/** Row-major occupancy: occupancy[x + dimX * (y + dimY * z)]; non-zero = solid. */
|
|
9
9
|
readonly occupancy: readonly (0 | 1)[];
|
|
10
10
|
}
|
|
11
|
+
export interface DeterministicVoxelRayHit3D {
|
|
12
|
+
readonly hit: boolean;
|
|
13
|
+
readonly distance: number;
|
|
14
|
+
readonly voxelX: number;
|
|
15
|
+
readonly voxelY: number;
|
|
16
|
+
readonly voxelZ: number;
|
|
17
|
+
readonly point: {
|
|
18
|
+
readonly x: number;
|
|
19
|
+
readonly y: number;
|
|
20
|
+
readonly z: number;
|
|
21
|
+
};
|
|
22
|
+
readonly normal: {
|
|
23
|
+
readonly x: number;
|
|
24
|
+
readonly y: number;
|
|
25
|
+
readonly z: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
11
28
|
export type DeterministicVoxelCompoundShape3D = Extract<DeterministicPhysicsShape3D, {
|
|
12
29
|
readonly type: 'compound';
|
|
13
30
|
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Amanatides & Woo 3D Digital Differential Analyzer (DDA) fast voxel grid raycaster.
|
|
33
|
+
* Marches through chunk cells in O(distance) directly over the occupancy bitset.
|
|
34
|
+
*/
|
|
35
|
+
export declare function raycastDeterministicVoxelChunk3D(chunk: DeterministicVoxelChunk3D, query: DeterministicPhysicsRaycastQuery3D): DeterministicVoxelRayHit3D | undefined;
|
|
14
36
|
/**
|
|
15
37
|
* Deterministic greedy box merge: scan z→y→x ascending and grow each unconsumed
|
|
16
38
|
* solid cell into the largest box along +x, then +y, then +z. A solid n³ chunk
|
package/dist/physics3d-voxel.js
CHANGED
|
@@ -1,3 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Amanatides & Woo 3D Digital Differential Analyzer (DDA) fast voxel grid raycaster.
|
|
3
|
+
* Marches through chunk cells in O(distance) directly over the occupancy bitset.
|
|
4
|
+
*/
|
|
5
|
+
export function raycastDeterministicVoxelChunk3D(chunk, query) {
|
|
6
|
+
const { dimX, dimY, dimZ, cellSize, occupancy } = chunk;
|
|
7
|
+
if (cellSize <= 0 || occupancy.length !== dimX * dimY * dimZ) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
const dirLen = Math.hypot(query.dx, query.dy, query.dz);
|
|
11
|
+
if (dirLen <= 1e-12) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const dx = query.dx / dirLen;
|
|
15
|
+
const dy = query.dy / dirLen;
|
|
16
|
+
const dz = query.dz / dirLen;
|
|
17
|
+
const maxDistance = query.maxDistance;
|
|
18
|
+
if (maxDistance < 0) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
const ox = query.x / cellSize;
|
|
22
|
+
const oy = query.y / cellSize;
|
|
23
|
+
const oz = query.z / cellSize;
|
|
24
|
+
let tMin = 0;
|
|
25
|
+
let tMax = maxDistance / cellSize;
|
|
26
|
+
let enterNormal = { x: 0, y: 0, z: 0 };
|
|
27
|
+
const axes = [
|
|
28
|
+
{ o: ox, d: dx, min: 0, max: dimX, nx: 1, ny: 0, nz: 0 },
|
|
29
|
+
{ o: oy, d: dy, min: 0, max: dimY, nx: 0, ny: 1, nz: 0 },
|
|
30
|
+
{ o: oz, d: dz, min: 0, max: dimZ, nx: 0, ny: 0, nz: 1 },
|
|
31
|
+
];
|
|
32
|
+
for (const axis of axes) {
|
|
33
|
+
if (Math.abs(axis.d) < 1e-12) {
|
|
34
|
+
if (axis.o < axis.min || axis.o > axis.max) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
let t1 = (axis.min - axis.o) / axis.d;
|
|
40
|
+
let t2 = (axis.max - axis.o) / axis.d;
|
|
41
|
+
let n1 = { x: -axis.nx, y: -axis.ny, z: -axis.nz };
|
|
42
|
+
if (t1 > t2) {
|
|
43
|
+
const temp = t1;
|
|
44
|
+
t1 = t2;
|
|
45
|
+
t2 = temp;
|
|
46
|
+
n1 = { x: axis.nx, y: axis.ny, z: axis.nz };
|
|
47
|
+
}
|
|
48
|
+
if (t1 > tMin) {
|
|
49
|
+
tMin = t1;
|
|
50
|
+
enterNormal = n1;
|
|
51
|
+
}
|
|
52
|
+
if (t2 < tMax) {
|
|
53
|
+
tMax = t2;
|
|
54
|
+
}
|
|
55
|
+
if (tMin > tMax) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (ox >= 0 && ox < dimX && oy >= 0 && oy < dimY && oz >= 0 && oz < dimZ) {
|
|
61
|
+
tMin = 0;
|
|
62
|
+
}
|
|
63
|
+
const startX = ox + dx * tMin;
|
|
64
|
+
const startY = oy + dy * tMin;
|
|
65
|
+
const startZ = oz + dz * tMin;
|
|
66
|
+
let currentX = Math.floor(startX);
|
|
67
|
+
let currentY = Math.floor(startY);
|
|
68
|
+
let currentZ = Math.floor(startZ);
|
|
69
|
+
currentX = Math.max(0, Math.min(dimX - 1, currentX));
|
|
70
|
+
currentY = Math.max(0, Math.min(dimY - 1, currentY));
|
|
71
|
+
currentZ = Math.max(0, Math.min(dimZ - 1, currentZ));
|
|
72
|
+
const stepX = dx > 0 ? 1 : dx < 0 ? -1 : 0;
|
|
73
|
+
const stepY = dy > 0 ? 1 : dy < 0 ? -1 : 0;
|
|
74
|
+
const stepZ = dz > 0 ? 1 : dz < 0 ? -1 : 0;
|
|
75
|
+
const tDeltaX = stepX !== 0 ? Math.abs(1 / dx) : Infinity;
|
|
76
|
+
const tDeltaY = stepY !== 0 ? Math.abs(1 / dy) : Infinity;
|
|
77
|
+
const tDeltaZ = stepZ !== 0 ? Math.abs(1 / dz) : Infinity;
|
|
78
|
+
let tMaxX = stepX > 0 ? (currentX + 1 - ox) / dx : stepX < 0 ? (currentX - ox) / dx : Infinity;
|
|
79
|
+
let tMaxY = stepY > 0 ? (currentY + 1 - oy) / dy : stepY < 0 ? (currentY - oy) / dy : Infinity;
|
|
80
|
+
let tMaxZ = stepZ > 0 ? (currentZ + 1 - oz) / dz : stepZ < 0 ? (currentZ - oz) / dz : Infinity;
|
|
81
|
+
let currentNormal = enterNormal;
|
|
82
|
+
let hitDistanceGrid = tMin;
|
|
83
|
+
while (currentX >= 0 && currentX < dimX && currentY >= 0 && currentY < dimY && currentZ >= 0 && currentZ < dimZ) {
|
|
84
|
+
const cellIndex = currentX + dimX * (currentY + dimY * currentZ);
|
|
85
|
+
if (occupancy[cellIndex] === 1) {
|
|
86
|
+
const worldDistance = hitDistanceGrid * cellSize;
|
|
87
|
+
if (worldDistance > maxDistance) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
const hitPoint = {
|
|
91
|
+
x: query.x + dx * worldDistance,
|
|
92
|
+
y: query.y + dy * worldDistance,
|
|
93
|
+
z: query.z + dz * worldDistance,
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
hit: true,
|
|
97
|
+
distance: worldDistance,
|
|
98
|
+
voxelX: currentX,
|
|
99
|
+
voxelY: currentY,
|
|
100
|
+
voxelZ: currentZ,
|
|
101
|
+
point: hitPoint,
|
|
102
|
+
normal: currentNormal,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (tMaxX < tMaxY) {
|
|
106
|
+
if (tMaxX < tMaxZ) {
|
|
107
|
+
hitDistanceGrid = tMaxX;
|
|
108
|
+
tMaxX += tDeltaX;
|
|
109
|
+
currentX += stepX;
|
|
110
|
+
currentNormal = { x: -stepX, y: 0, z: 0 };
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
hitDistanceGrid = tMaxZ;
|
|
114
|
+
tMaxZ += tDeltaZ;
|
|
115
|
+
currentZ += stepZ;
|
|
116
|
+
currentNormal = { x: 0, y: 0, z: -stepZ };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
if (tMaxY < tMaxZ) {
|
|
121
|
+
hitDistanceGrid = tMaxY;
|
|
122
|
+
tMaxY += tDeltaY;
|
|
123
|
+
currentY += stepY;
|
|
124
|
+
currentNormal = { x: 0, y: -stepY, z: 0 };
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
hitDistanceGrid = tMaxZ;
|
|
128
|
+
tMaxZ += tDeltaZ;
|
|
129
|
+
currentZ += stepZ;
|
|
130
|
+
currentNormal = { x: 0, y: 0, z: -stepZ };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (hitDistanceGrid > tMax) {
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
1
139
|
/**
|
|
2
140
|
* Deterministic greedy box merge: scan z→y→x ascending and grow each unconsumed
|
|
3
141
|
* solid cell into the largest box along +x, then +y, then +z. A solid n³ chunk
|
package/dist/physics3d.d.ts
CHANGED
|
@@ -202,6 +202,23 @@ export interface DeterministicPhysicsDetailedHit3D extends DeterministicPhysicsH
|
|
|
202
202
|
readonly point: Point3D;
|
|
203
203
|
readonly normal: Point3D;
|
|
204
204
|
readonly penetration: number;
|
|
205
|
+
readonly childIndex?: number;
|
|
206
|
+
}
|
|
207
|
+
export interface DeterministicKinematicPose3D {
|
|
208
|
+
readonly id: string;
|
|
209
|
+
readonly x: number;
|
|
210
|
+
readonly y: number;
|
|
211
|
+
readonly z: number;
|
|
212
|
+
readonly rx?: number;
|
|
213
|
+
readonly ry?: number;
|
|
214
|
+
readonly rz?: number;
|
|
215
|
+
readonly orientation?: DeterministicPhysicsQuaternion3D;
|
|
216
|
+
readonly vx?: number;
|
|
217
|
+
readonly vy?: number;
|
|
218
|
+
readonly vz?: number;
|
|
219
|
+
readonly angularVelX?: number;
|
|
220
|
+
readonly angularVelY?: number;
|
|
221
|
+
readonly angularVelZ?: number;
|
|
205
222
|
}
|
|
206
223
|
export interface DeterministicPhysicsScheduledQuery3D {
|
|
207
224
|
readonly id: string;
|
|
@@ -363,6 +380,15 @@ export interface DeterministicPhysicsWorldEdit3D {
|
|
|
363
380
|
* inside each edit list.
|
|
364
381
|
*/
|
|
365
382
|
export declare function applyDeterministicWorldEdit3D(world: DeterministicPhysicsWorld3D, edit: DeterministicPhysicsWorldEdit3D): DeterministicPhysicsWorld3D;
|
|
383
|
+
/**
|
|
384
|
+
* Fast batch update of kinematic body transforms and velocities without
|
|
385
|
+
* allocating Set instances or re-sorting world bodies. Wakes touching dynamic
|
|
386
|
+
* bodies across active contact pairs. If linear velocity (vx, vy, vz) is omitted
|
|
387
|
+
* and dtTicks (> 0) is supplied, linear velocity is derived as (newPos - oldPos) / dtTicks.
|
|
388
|
+
*/
|
|
389
|
+
export declare function setDeterministicKinematicPoses3D(world: DeterministicPhysicsWorld3D, poses: readonly DeterministicKinematicPose3D[], options?: {
|
|
390
|
+
readonly dtTicks?: number;
|
|
391
|
+
}): DeterministicPhysicsWorld3D;
|
|
366
392
|
/**
|
|
367
393
|
* Apply a deterministic impulse to a body (linear + angular via lever arm),
|
|
368
394
|
* waking the body and its contact island. Returns a new canonical world.
|
package/dist/physics3d.js
CHANGED
|
@@ -281,6 +281,104 @@ export function applyDeterministicWorldEdit3D(world, edit) {
|
|
|
281
281
|
: world.jointCache.filter((entry) => !removeJointIds.has(entry.jointId)),
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Fast batch update of kinematic body transforms and velocities without
|
|
286
|
+
* allocating Set instances or re-sorting world bodies. Wakes touching dynamic
|
|
287
|
+
* bodies across active contact pairs. If linear velocity (vx, vy, vz) is omitted
|
|
288
|
+
* and dtTicks (> 0) is supplied, linear velocity is derived as (newPos - oldPos) / dtTicks.
|
|
289
|
+
*/
|
|
290
|
+
export function setDeterministicKinematicPoses3D(world, poses, options = {}) {
|
|
291
|
+
if (poses.length === 0) {
|
|
292
|
+
return world;
|
|
293
|
+
}
|
|
294
|
+
const dt = options.dtTicks !== undefined && options.dtTicks > 0 ? options.dtTicks : undefined;
|
|
295
|
+
const poseById = new Map();
|
|
296
|
+
for (const pose of poses) {
|
|
297
|
+
if (!Number.isFinite(pose.x) || !Number.isFinite(pose.y) || !Number.isFinite(pose.z)) {
|
|
298
|
+
throw new Error(`setDeterministicKinematicPoses3D: body ${pose.id} position must be finite numbers`);
|
|
299
|
+
}
|
|
300
|
+
poseById.set(pose.id, pose);
|
|
301
|
+
}
|
|
302
|
+
const updatedIds = new Set();
|
|
303
|
+
const movedBodies = new Map();
|
|
304
|
+
const newBodies = world.bodies.map((body) => {
|
|
305
|
+
const pose = poseById.get(body.id);
|
|
306
|
+
if (pose === undefined) {
|
|
307
|
+
return body;
|
|
308
|
+
}
|
|
309
|
+
if (body.kind !== 'kinematic') {
|
|
310
|
+
throw new Error(`setDeterministicKinematicPoses3D: body ${body.id} is ${body.kind}, expected kinematic`);
|
|
311
|
+
}
|
|
312
|
+
updatedIds.add(body.id);
|
|
313
|
+
let vx = pose.vx;
|
|
314
|
+
let vy = pose.vy;
|
|
315
|
+
let vz = pose.vz;
|
|
316
|
+
if (vx === undefined || vy === undefined || vz === undefined) {
|
|
317
|
+
if (dt !== undefined) {
|
|
318
|
+
vx = vx ?? (pose.x - body.x) / dt;
|
|
319
|
+
vy = vy ?? (pose.y - body.y) / dt;
|
|
320
|
+
vz = vz ?? (pose.z - body.z) / dt;
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
vx = vx ?? body.vx;
|
|
324
|
+
vy = vy ?? body.vy;
|
|
325
|
+
vz = vz ?? body.vz;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
let angularVel = body.angularVel;
|
|
329
|
+
if (pose.angularVelX !== undefined || pose.angularVelY !== undefined || pose.angularVelZ !== undefined) {
|
|
330
|
+
angularVel = {
|
|
331
|
+
x: pose.angularVelX ?? body.angularVel?.x ?? 0,
|
|
332
|
+
y: pose.angularVelY ?? body.angularVel?.y ?? 0,
|
|
333
|
+
z: pose.angularVelZ ?? body.angularVel?.z ?? 0,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
const updated = {
|
|
337
|
+
...body,
|
|
338
|
+
x: pose.x,
|
|
339
|
+
y: pose.y,
|
|
340
|
+
z: pose.z,
|
|
341
|
+
vx,
|
|
342
|
+
vy,
|
|
343
|
+
vz,
|
|
344
|
+
rx: pose.rx ?? body.rx,
|
|
345
|
+
ry: pose.ry ?? body.ry,
|
|
346
|
+
rz: pose.rz ?? body.rz,
|
|
347
|
+
orientation: pose.orientation ?? body.orientation,
|
|
348
|
+
angularVel,
|
|
349
|
+
};
|
|
350
|
+
movedBodies.set(body.id, updated);
|
|
351
|
+
return updated;
|
|
352
|
+
});
|
|
353
|
+
for (const pose of poses) {
|
|
354
|
+
if (!updatedIds.has(pose.id)) {
|
|
355
|
+
throw new Error(`setDeterministicKinematicPoses3D: cannot update unknown kinematic body ${pose.id}`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
// Wake any dynamic bodies that share active pairs with updated kinematics
|
|
359
|
+
const wokenDynamicIds = new Set();
|
|
360
|
+
for (const pair of world.activePairMetadata) {
|
|
361
|
+
if (movedBodies.has(pair.a)) {
|
|
362
|
+
for (const member of contactIslandFor(world, pair.b)) {
|
|
363
|
+
wokenDynamicIds.add(member);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
else if (movedBodies.has(pair.b)) {
|
|
367
|
+
for (const member of contactIslandFor(world, pair.a)) {
|
|
368
|
+
wokenDynamicIds.add(member);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
const finalBodies = wokenDynamicIds.size === 0
|
|
373
|
+
? newBodies
|
|
374
|
+
: newBodies.map((body) => (wokenDynamicIds.has(body.id) && body.kind === 'dynamic' && body.sleeping
|
|
375
|
+
? { ...body, sleeping: false, lowVelFrames: 0 }
|
|
376
|
+
: body));
|
|
377
|
+
return {
|
|
378
|
+
...world,
|
|
379
|
+
bodies: finalBodies,
|
|
380
|
+
};
|
|
381
|
+
}
|
|
284
382
|
/**
|
|
285
383
|
* Apply a deterministic impulse to a body (linear + angular via lever arm),
|
|
286
384
|
* waking the body and its contact island. Returns a new canonical world.
|
|
@@ -3112,6 +3210,27 @@ function rayBodyDistance(body, query) {
|
|
|
3112
3210
|
if (body.shape.type === 'hull') {
|
|
3113
3211
|
return rayHullBodyDistance(body, body.shape, query);
|
|
3114
3212
|
}
|
|
3213
|
+
if (body.shape.type === 'compound') {
|
|
3214
|
+
let closestDistance;
|
|
3215
|
+
for (let index = 0; index < body.shape.children.length; index += 1) {
|
|
3216
|
+
const child = body.shape.children[index];
|
|
3217
|
+
const childBody = {
|
|
3218
|
+
...body,
|
|
3219
|
+
x: (body.x ?? 0) + (child.offset?.x ?? 0),
|
|
3220
|
+
y: (body.y ?? 0) + (child.offset?.y ?? 0),
|
|
3221
|
+
z: (body.z ?? 0) + (child.offset?.z ?? 0),
|
|
3222
|
+
shape: child.shape,
|
|
3223
|
+
rx: (body.rx ?? 0) + canonicalQuarterTurns(child.quarterTurns?.x ?? 0) / 4,
|
|
3224
|
+
ry: (body.ry ?? 0) + canonicalQuarterTurns(child.quarterTurns?.y ?? 0) / 4,
|
|
3225
|
+
rz: (body.rz ?? 0) + canonicalQuarterTurns(child.quarterTurns?.z ?? 0) / 4,
|
|
3226
|
+
};
|
|
3227
|
+
const childDistance = rayBodyDistance(childBody, query);
|
|
3228
|
+
if (childDistance !== undefined && (closestDistance === undefined || childDistance < closestDistance)) {
|
|
3229
|
+
closestDistance = childDistance;
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
return closestDistance;
|
|
3233
|
+
}
|
|
3115
3234
|
return rayAabbDistance(toBounds(body), query);
|
|
3116
3235
|
}
|
|
3117
3236
|
function rayHullBodyDistance(body, shape, query) {
|
|
@@ -3425,13 +3544,61 @@ function countCandidatePairs(bodies) {
|
|
|
3425
3544
|
countCandidatePairsCalls += 1;
|
|
3426
3545
|
return broadphaseCandidatePairs(bodies).length;
|
|
3427
3546
|
}
|
|
3547
|
+
function compoundChildDetailedHit(body, query, distance) {
|
|
3548
|
+
if (body.shape.type !== 'compound') {
|
|
3549
|
+
return undefined;
|
|
3550
|
+
}
|
|
3551
|
+
let bestChildIndex;
|
|
3552
|
+
let bestNormal;
|
|
3553
|
+
let bestDistDiff = Infinity;
|
|
3554
|
+
for (let index = 0; index < body.shape.children.length; index += 1) {
|
|
3555
|
+
const child = body.shape.children[index];
|
|
3556
|
+
const childBody = {
|
|
3557
|
+
...body,
|
|
3558
|
+
x: (body.x ?? 0) + (child.offset?.x ?? 0),
|
|
3559
|
+
y: (body.y ?? 0) + (child.offset?.y ?? 0),
|
|
3560
|
+
z: (body.z ?? 0) + (child.offset?.z ?? 0),
|
|
3561
|
+
shape: child.shape,
|
|
3562
|
+
rx: (body.rx ?? 0) + canonicalQuarterTurns(child.quarterTurns?.x ?? 0) / 4,
|
|
3563
|
+
ry: (body.ry ?? 0) + canonicalQuarterTurns(child.quarterTurns?.y ?? 0) / 4,
|
|
3564
|
+
rz: (body.rz ?? 0) + canonicalQuarterTurns(child.quarterTurns?.z ?? 0) / 4,
|
|
3565
|
+
};
|
|
3566
|
+
const childDist = 'dx' in query ? rayBodyDistance(childBody, query) : undefined;
|
|
3567
|
+
if (childDist !== undefined) {
|
|
3568
|
+
const diff = Math.abs(childDist - distance);
|
|
3569
|
+
if (diff < bestDistDiff) {
|
|
3570
|
+
bestDistDiff = diff;
|
|
3571
|
+
bestChildIndex = index;
|
|
3572
|
+
const center = quantizePoint({
|
|
3573
|
+
x: query.x + query.dx * childDist,
|
|
3574
|
+
y: query.y + query.dy * childDist,
|
|
3575
|
+
z: query.z + query.dz * childDist,
|
|
3576
|
+
});
|
|
3577
|
+
bestNormal = hitNormalForBody(childBody, center);
|
|
3578
|
+
}
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
if (bestChildIndex !== undefined && bestNormal !== undefined) {
|
|
3582
|
+
return { childIndex: bestChildIndex, normal: bestNormal };
|
|
3583
|
+
}
|
|
3584
|
+
return undefined;
|
|
3585
|
+
}
|
|
3428
3586
|
function detailedHitForBody(body, query, distance, castRadius) {
|
|
3429
3587
|
const center = quantizePoint({
|
|
3430
3588
|
x: query.x + query.dx * distance,
|
|
3431
3589
|
y: query.y + query.dy * distance,
|
|
3432
3590
|
z: query.z + query.dz * distance,
|
|
3433
3591
|
});
|
|
3434
|
-
|
|
3592
|
+
let normal;
|
|
3593
|
+
let childIndex;
|
|
3594
|
+
if (body.shape.type === 'compound') {
|
|
3595
|
+
const compoundHit = compoundChildDetailedHit(body, query, distance);
|
|
3596
|
+
childIndex = compoundHit?.childIndex;
|
|
3597
|
+
normal = compoundHit?.normal ?? hitNormalForBody(body, center);
|
|
3598
|
+
}
|
|
3599
|
+
else {
|
|
3600
|
+
normal = hitNormalForBody(body, center);
|
|
3601
|
+
}
|
|
3435
3602
|
const point = quantizePoint({
|
|
3436
3603
|
x: center.x - normal.x * castRadius,
|
|
3437
3604
|
y: center.y - normal.y * castRadius,
|
|
@@ -3443,6 +3610,7 @@ function detailedHitForBody(body, query, distance, castRadius) {
|
|
|
3443
3610
|
point,
|
|
3444
3611
|
normal,
|
|
3445
3612
|
penetration: distance === 0 ? penetrationAtPoint(body, center, castRadius) : 0,
|
|
3613
|
+
childIndex,
|
|
3446
3614
|
};
|
|
3447
3615
|
}
|
|
3448
3616
|
function hitNormalForBody(body, point) {
|
|
@@ -3453,6 +3621,24 @@ function hitNormalForBody(body, point) {
|
|
|
3453
3621
|
z: point.z - body.z,
|
|
3454
3622
|
});
|
|
3455
3623
|
}
|
|
3624
|
+
if (body.shape.type === 'capsule') {
|
|
3625
|
+
const halfHeight = body.shape.halfHeight;
|
|
3626
|
+
let localPoint = { x: point.x - body.x, y: point.y - body.y, z: point.z - body.z };
|
|
3627
|
+
if (body.orientation !== undefined) {
|
|
3628
|
+
localPoint = rotatePointByQuatInverse(body.orientation, localPoint);
|
|
3629
|
+
}
|
|
3630
|
+
const clampedY = Math.max(-halfHeight, Math.min(halfHeight, localPoint.y));
|
|
3631
|
+
const localDelta = {
|
|
3632
|
+
x: localPoint.x,
|
|
3633
|
+
y: localPoint.y - clampedY,
|
|
3634
|
+
z: localPoint.z,
|
|
3635
|
+
};
|
|
3636
|
+
const localNormal = normalizePoint(localDelta);
|
|
3637
|
+
if (body.orientation !== undefined) {
|
|
3638
|
+
return normalizePoint(rotatePointByQuat(body.orientation, localNormal));
|
|
3639
|
+
}
|
|
3640
|
+
return localNormal;
|
|
3641
|
+
}
|
|
3456
3642
|
const bounds = toBounds(body);
|
|
3457
3643
|
const candidates = [
|
|
3458
3644
|
{ normal: { x: -1, y: 0, z: 0 }, distance: Math.abs(point.x - bounds.minX), axis: 'x-' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@series-inc/rundot-syncplay",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.27.0",
|
|
4
4
|
"description": "Kinetix orchestration, rollback, replay, late-join, and deterministic networking for RUN.game",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"test:core": "node --expose-gc --import tsx --test --test-concurrency=1 tests/canonical.test.ts tests/canonical-portability.test.ts tests/runtime-session.test.ts tests/kinetix-runtime-session.test.ts tests/runtime-support.test.ts tests/runtime-guards.test.ts tests/r3f-render-adapter.test.ts tests/snapshot-cost.test.ts tests/sdkSession.test.ts tests/input-authority.test.ts tests/session-wire.test.ts tests/runtime-room-metadata.test.ts tests/session-snapshot.test.ts tests/authority-room.test.ts tests/networked-client-snapshot.test.ts tests/runner.test.ts tests/testing.test.ts tests/browser-session.test.ts tests/secret-config.test.ts tests/secret-protocol.test.ts tests/secret-authority.test.ts tests/secret-client.test.ts tests/late-join-checksum.test.ts tests/late-join-input-backfill.test.ts tests/replay-scoring.test.ts tests/bot-backfill.test.ts tests/latency-simulation.test.ts tests/production-input-budget.test.ts tests/time-sync.test.ts tests/match-log.test.ts tests/spectator.test.ts tests/synctest.test.ts tests/instant-replay.test.ts tests/session-promotion.test.ts tests/physics3d-broadphase-stats.test.ts tests/entrypoints.test.ts tests/export-surface.test.ts tests/module-seam.test.ts tests/module-contract-portability.test.ts tests/module-identity.test.ts tests/module-corpus.test.ts tests/component-model.test.ts tests/component-model-rollback.test.ts tests/component-model-integration.test.ts tests/actors-ai.test.ts tests/character-3d.test.ts tests/character-3d-certification.test.ts tests/combat-modules.test.ts tests/combat-modules-integration.test.ts tests/firearm.test.ts tests/gameplay-effects.test.ts tests/spatial-interaction.test.ts tests/stats-abilities.test.ts tests/inventory-equipment.test.ts tests/inventory-equipment-certification.test.ts tests/platformer-2d.test.ts tests/platformer-2d-certification.test.ts tests/module-promotion.test.ts tests/module-docs.test.ts tests/module-bundle-budget.test.ts tests/published-side-effects.test.ts tests/host-timing.test.ts tests/test-manifest.test.ts tests/coarse-region.test.ts tests/input-codec.test.ts tests/command-ingress.test.ts tests/session-reconfigure.test.ts tests/prediction-mode.test.ts tests/ephemeral-channel.test.ts tests/runner-surface.test.ts tests/runner-harness.test.ts tests/effects-adapter-bounds.test.ts tests/simulated-match-secrets.test.ts tests/run-glue-surface.test.mjs core/tests/core-boundary.test.mjs tests/math-core-parity.test.ts tests/math-profile.test.ts tests/movement3d-kcc-unit-contract.test.ts tests/movement3d-static-ground.test.ts",
|
|
164
164
|
"test:sdk-contract": "node --import tsx --test tests/sdk-runtime-contract.test.ts",
|
|
165
165
|
"test:soak": "tsx --test tests/runtime-soak.test.ts",
|
|
166
|
-
"test:extended": "tsx --test tests/kcc-vehicle-characterization.test.ts tests/animation.test.ts tests/asset-cooking.test.ts tests/backend-proof-checksum-vectors.test.ts tests/bot-documents.test.ts tests/bot-primitives.test.ts tests/collider-cooking.test.ts tests/collision.test.ts tests/command-timeline.test.ts tests/config-bundle.test.ts tests/cosmetic-physics3d.test.ts tests/deterministic-primitives.test.ts tests/ecs-lite.test.ts tests/effects-adapter.test.ts tests/engine-runtime.test.ts tests/errors.test.ts tests/events.test.ts tests/input-button.test.ts tests/load-128-players.test.ts tests/math.test.ts tests/movement.test.ts tests/movement3d.test.ts tests/multiclient-authority.test.ts tests/navigation.test.ts tests/noise.test.ts tests/physics-cert.test.ts tests/physics2d.test.ts tests/physics3d-ccd.test.ts tests/physics3d-coverage.test.ts tests/physics3d-destruction-cert.test.ts tests/physics3d-geometry-limits.test.ts tests/physics3d-heightfield.test.ts tests/physics3d-hull.test.ts tests/physics3d-joints.test.ts tests/physics3d-kinematic-mesh.test.ts tests/physics3d-mass.test.ts tests/physics3d-materials.test.ts tests/physics3d-mesh-onesided.test.ts tests/physics3d-query-index.test.ts tests/physics3d-recipes.test.ts tests/physics3d-rotation-convention.test.ts tests/physics3d-shared.test.ts tests/physics3d-sleeping-manifold-reuse.test.ts tests/physics3d-solver.test.ts tests/physics3d-static-memoization.test.ts tests/physics3d-static-overlap-memo.test.ts tests/physics3d-cylinder-hull.test.ts tests/physics3d-stacking.test.ts tests/physics3d-toi.test.ts tests/physics3d-vehicle.test.ts tests/physics3d-voxel.test.ts tests/physics3d-world-edit.test.ts tests/physics3d.test.ts tests/physics-vector-generator.test.ts tests/random.test.ts tests/rollback-history.test.ts tests/schema-artifacts.test.ts tests/schema-codegen.test.ts tests/schema-dsl-binary.test.ts tests/schema.test.ts tests/signals.test.ts tests/sparse-set.test.ts tests/static-checker.test.ts tests/system-lifecycle.test.ts tests/wire-canonical-sentinels.test.ts tests/ws-frame.test.ts",
|
|
166
|
+
"test:extended": "tsx --test tests/kcc-vehicle-characterization.test.ts tests/animation.test.ts tests/asset-cooking.test.ts tests/backend-proof-checksum-vectors.test.ts tests/bot-documents.test.ts tests/bot-primitives.test.ts tests/collider-cooking.test.ts tests/collision.test.ts tests/command-timeline.test.ts tests/config-bundle.test.ts tests/cosmetic-physics3d.test.ts tests/deterministic-primitives.test.ts tests/ecs-lite.test.ts tests/effects-adapter.test.ts tests/engine-runtime.test.ts tests/errors.test.ts tests/events.test.ts tests/input-button.test.ts tests/load-128-players.test.ts tests/math.test.ts tests/movement.test.ts tests/movement3d.test.ts tests/multiclient-authority.test.ts tests/navigation.test.ts tests/noise.test.ts tests/physics-cert.test.ts tests/physics2d.test.ts tests/physics3d-ccd.test.ts tests/physics3d-coverage.test.ts tests/physics3d-destruction-cert.test.ts tests/physics3d-geometry-limits.test.ts tests/physics3d-heightfield.test.ts tests/physics3d-hull.test.ts tests/physics3d-joints.test.ts tests/physics3d-kinematic-mesh.test.ts tests/physics3d-kinematic-poses.test.ts tests/physics3d-mass.test.ts tests/physics3d-materials.test.ts tests/physics3d-mesh-onesided.test.ts tests/physics3d-queries-capsule-childindex.test.ts tests/physics3d-query-index.test.ts tests/physics3d-recipes.test.ts tests/physics3d-rotation-convention.test.ts tests/physics3d-shared.test.ts tests/physics3d-sleeping-manifold-reuse.test.ts tests/physics3d-solver.test.ts tests/physics3d-static-memoization.test.ts tests/physics3d-static-overlap-memo.test.ts tests/physics3d-cylinder-hull.test.ts tests/physics3d-stacking.test.ts tests/physics3d-toi.test.ts tests/physics3d-vehicle.test.ts tests/physics3d-voxel-dda.test.ts tests/physics3d-voxel.test.ts tests/physics3d-world-edit.test.ts tests/physics3d.test.ts tests/physics-vector-generator.test.ts tests/random.test.ts tests/rollback-history.test.ts tests/schema-artifacts.test.ts tests/schema-codegen.test.ts tests/schema-dsl-binary.test.ts tests/schema.test.ts tests/signals.test.ts tests/sparse-set.test.ts tests/static-checker.test.ts tests/system-lifecycle.test.ts tests/wire-canonical-sentinels.test.ts tests/ws-frame.test.ts",
|
|
167
167
|
"test:ci": "npm run build && npm run test",
|
|
168
168
|
"build:native": "node core/scripts/build-native.mjs",
|
|
169
169
|
"build:mobile-native": "node core/scripts/build-mobile-native.mjs",
|