@daneren2005/shared-memory-physics 1.7.2 → 1.8.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.
Files changed (38) hide show
  1. package/README.md +18 -3
  2. package/dist/actions/add-physical-world-data.d.ts +2 -0
  3. package/dist/actions/combine-dynamics-commands.d.ts +2 -0
  4. package/dist/{systems/dynamics.d.ts → actions/dynamics-commands.d.ts} +1 -7
  5. package/dist/actions/find-dynamics-command-offset.d.ts +2 -0
  6. package/dist/actions/find-dynamics-command.d.ts +2 -0
  7. package/dist/actions/get-spatial-map.d.ts +3 -0
  8. package/dist/actions/integrate-dynamics.d.ts +3 -0
  9. package/dist/actions/queue-dynamics-vector.d.ts +2 -0
  10. package/dist/actions/queue-velocity-assignment.d.ts +2 -0
  11. package/dist/actions/set-entity-position.d.ts +7 -0
  12. package/dist/actions/snap-entity.d.ts +9 -0
  13. package/dist/actions/start-spawn-interpolation.d.ts +16 -0
  14. package/dist/actions/update-spatial-map.d.ts +3 -0
  15. package/dist/components/body-component-constants.d.ts +15 -0
  16. package/dist/components/body-component.d.ts +0 -15
  17. package/dist/components/bounciness-component-constants.d.ts +2 -0
  18. package/dist/components/bounciness-component.d.ts +0 -2
  19. package/dist/components/dynamics-component-constants.d.ts +4 -0
  20. package/dist/components/dynamics-component.d.ts +0 -4
  21. package/dist/components/interpolation-component-constants.d.ts +18 -0
  22. package/dist/components/interpolation-component.d.ts +0 -40
  23. package/dist/components/polygon-component-constants.d.ts +4 -0
  24. package/dist/components/polygon-component.d.ts +0 -4
  25. package/dist/components/transform-component-constants.d.ts +6 -0
  26. package/dist/components/transform-component.d.ts +1 -7
  27. package/dist/components/velocity-component-constants.d.ts +4 -0
  28. package/dist/components/velocity-component.d.ts +0 -4
  29. package/dist/constants.d.ts +5 -0
  30. package/dist/index.d.ts +24 -15
  31. package/dist/index.js +399 -364
  32. package/dist/index.js.map +1 -1
  33. package/dist/systems/collision.d.ts +1 -2
  34. package/dist/systems/interpolation-update.d.ts +0 -2
  35. package/dist/systems/physics-system.d.ts +4 -5
  36. package/dist/systems/physics-update.d.ts +2 -5
  37. package/dist/world.d.ts +0 -2
  38. package/package.json +8 -8
package/README.md CHANGED
@@ -19,7 +19,7 @@ npm install @daneren2005/shared-memory-physics @daneren2005/shared-memory-ecs @d
19
19
  | Component | Config | Serialization | Block |
20
20
  | --------------- | -------------------------------------------- | -------------------------- | ---------------------------------------------- |
21
21
  | `dynamics` | - | `accelerationX?`, `accelerationY?`, `mass?` | `Float32Array` - acceleration and inverse mass |
22
- | `transform` | `width`, `height`, `angle?` / `radius` | `x`, `y`, `angle` | `Float32Array` – where, how big, facing |
22
+ | `transform` | `width`, `height`, `angle?` / `radius` | `x`, `y`, `angle?` | `Float32Array` – where, how big, facing |
23
23
  | `velocity` | – | `velocityX?`, `velocityY?`, `damping?` | `Float32Array` – world units per second |
24
24
  | `body` | `shape?`, `collideCategory?`, `collideMask?`, `sensor?`, `continuousCollisionDetection?`, `blocksPath?` | – | `Uint32Array` – what shape, what collides with |
25
25
  | `interpolation` | `interpolate` | – | `Float32Array` – where to *draw* it |
@@ -59,8 +59,8 @@ effective mass `1` when a force or impulse is queued for it.
59
59
  The transform is split in two. **Config** is what your entity template says - `width` and `height` are
60
60
  required, `angle` defaults to `0` - and a size is what loads the component at all: a config with neither a
61
61
  width nor a height does not get a transform. **Serialization** is the live state that changes as the world
62
- runs, so `save()` returns `x` / `y` and `angle`, while a reloaded entity gets its size back from your own
63
- template rather than the save.
62
+ runs, so `save()` returns `x` / `y` and includes `angle` only when it is nonzero. An omitted angle defaults
63
+ to `0` on load, while a reloaded entity gets its size back from your own template rather than the save.
64
64
 
65
65
  `x` / `y` are the **centre** of the box, not a corner: the box is rotated about that point and collision
66
66
  projects out from it in both directions. `angle` is in **radians** counter-clockwise from the +x axis, and
@@ -844,6 +844,21 @@ box around their actual outline. A direct transform/body edit outside the physic
844
844
  `world.updateSpatialEntity(entity)`. A custom physics wrapper that changes a transform after calling the library
845
845
  update can call `updateSpatialMap(workerWorld, entityId, components)` instead.
846
846
 
847
+ For absolute placement from a worker update or an in-process update, `setEntityPosition` writes both coordinates
848
+ and refreshes the shared index immediately on the calling thread:
849
+
850
+ ```ts
851
+ import { setEntityPosition } from '@daneren2005/shared-memory-physics';
852
+
853
+ setEntityPosition(workerWorld, { entityId, components }, { x: 300, y: 400 });
854
+ ```
855
+
856
+ It accepts raw query/update blocks, ignores entities without a transform, and uses the optional body for
857
+ shape-aware bounds. Each coordinate is stored atomically; the position and index update are not one transaction.
858
+ It performs no collision sweep and does not change velocity or interpolation. For an interpolated teleport,
859
+ reset the render state separately with `snapEntity` on the entity wrapper. Without a spatial map in the run
860
+ world, it only writes the transform. Share the map with custom workers as described below.
861
+
847
862
  Games with registered ECS wrapper classes can pass their entity union as `PhysicalWorld`'s second generic. The
848
863
  world's entity map, lifecycle callbacks, and spatial-query results then retain that union instead of widening to
849
864
  `BaseEntity`.
@@ -0,0 +1,2 @@
1
+ import type { PhysicalWorldSource, PhysicalWorldData } from '../world';
2
+ export declare function addPhysicalWorldData(source: PhysicalWorldSource, target: PhysicalWorldData): void;
@@ -0,0 +1,2 @@
1
+ import type { DynamicsCommand, DynamicsCommands } from './dynamics-commands';
2
+ export declare function combineDynamicsCommands(queued: ReadonlyMap<number, Omit<DynamicsCommand, 'entityId'>>, incoming: DynamicsCommands | undefined): DynamicsCommands | undefined;
@@ -34,10 +34,4 @@ export interface DynamicsWorld {
34
34
  elapsedTime: number;
35
35
  dynamicsCommands?: DynamicsCommands;
36
36
  }
37
- export declare function queueDynamicsVector(commands: PendingDynamicsCommands, entityId: number, forceX: number, forceY: number, impulseX: number, impulseY: number): void;
38
- export declare function queueVelocityAssignment(commands: PendingDynamicsCommands, entityId: number, velocity: VelocityAssignment): void;
39
- export declare function combineDynamicsCommands(queued: ReadonlyMap<number, Omit<DynamicsCommand, 'entityId'>>, incoming: DynamicsCommands | undefined): DynamicsCommands | undefined;
40
- export declare function integrateDynamics(world: DynamicsWorld, entityId: number, velocity: Float32Array, dynamics?: Float32Array): void;
41
- export declare function findDynamicsCommand(commands: ReadonlyArray<DynamicsCommand> | undefined, entityId: number): DynamicsCommand | undefined;
42
- export declare function findDynamicsCommandOffset(commands: DynamicsCommandBuffer, entityId: number): number;
43
- export default integrateDynamics;
37
+ export declare function emptyCommand(): Omit<DynamicsCommand, 'entityId'>;
@@ -0,0 +1,2 @@
1
+ import type { DynamicsCommandBuffer } from './dynamics-commands';
2
+ export declare function findDynamicsCommandOffset(commands: DynamicsCommandBuffer, entityId: number): number;
@@ -0,0 +1,2 @@
1
+ import type { DynamicsCommand } from './dynamics-commands';
2
+ export declare function findDynamicsCommand(commands: ReadonlyArray<DynamicsCommand> | undefined, entityId: number): DynamicsCommand | undefined;
@@ -0,0 +1,3 @@
1
+ import SharedSpatialMap from '@daneren2005/shared-memory-objects/spatial/shared-spatial-map';
2
+ import type { PhysicalSystemWorld } from '../world';
3
+ export declare function getSpatialMap(world: PhysicalSystemWorld): SharedSpatialMap;
@@ -0,0 +1,3 @@
1
+ import type { DynamicsWorld } from './dynamics-commands';
2
+ export declare function integrateDynamics(world: DynamicsWorld, entityId: number, velocity: Float32Array, dynamics?: Float32Array): void;
3
+ export default integrateDynamics;
@@ -0,0 +1,2 @@
1
+ import type { PendingDynamicsCommands } from './dynamics-commands';
2
+ export declare function queueDynamicsVector(commands: PendingDynamicsCommands, entityId: number, forceX: number, forceY: number, impulseX: number, impulseY: number): void;
@@ -0,0 +1,2 @@
1
+ import type { PendingDynamicsCommands, VelocityAssignment } from './dynamics-commands';
2
+ export declare function queueVelocityAssignment(commands: PendingDynamicsCommands, entityId: number, velocity: VelocityAssignment): void;
@@ -0,0 +1,7 @@
1
+ import type { EntityUpdateComponents } from '@daneren2005/shared-memory-ecs/worker';
2
+ import type { Vector } from '../math/shapes';
3
+ import type { PhysicalSystemWorld } from '../world';
4
+ export declare function setEntityPosition(world: PhysicalSystemWorld, entity: {
5
+ entityId: number;
6
+ components: EntityUpdateComponents;
7
+ }, position: Vector): void;
@@ -0,0 +1,9 @@
1
+ import type { TransformComponent } from '../components/transform-component';
2
+ import type { InterpolationComponent } from '../components/interpolation-component';
3
+ export interface SnappableEntity {
4
+ components: {
5
+ transform?: TransformComponent;
6
+ interpolation?: InterpolationComponent;
7
+ };
8
+ }
9
+ export declare function snapEntity(entity: SnappableEntity): void;
@@ -0,0 +1,16 @@
1
+ import type { TransformComponent } from '../components/transform-component';
2
+ import type { VelocityComponent } from '../components/velocity-component';
3
+ import type { InterpolationComponent } from '../components/interpolation-component';
4
+ export interface SpawnableEntity {
5
+ components: {
6
+ transform?: TransformComponent;
7
+ velocity?: VelocityComponent;
8
+ interpolation?: InterpolationComponent;
9
+ };
10
+ }
11
+ export interface SpawnInterpolationOptions {
12
+ stepMs: number;
13
+ stepFraction: number;
14
+ tick: number;
15
+ }
16
+ export declare function startSpawnInterpolation(entity: SpawnableEntity, options: SpawnInterpolationOptions): void;
@@ -0,0 +1,3 @@
1
+ import { type SpatialBlockComponents } from '../systems/spatial-bounds';
2
+ import type { PhysicalSystemWorld } from '../world';
3
+ export declare function updateSpatialMap(world: PhysicalSystemWorld, entityId: number, components: SpatialBlockComponents): void;
@@ -0,0 +1,15 @@
1
+ export declare const SHAPE_RECTANGLE = 1;
2
+ export declare const SHAPE_CIRCLE = 2;
3
+ export declare const SHAPE_CAPSULE = 3;
4
+ export declare const SHAPE_POLYGON = 4;
5
+ export declare const DEFAULT_COLLIDE_CATEGORY = 1;
6
+ export declare const DEFAULT_COLLIDE_MASK = 4294967295;
7
+ export declare const BODY_FLAGS_INDEX = 0;
8
+ export declare const BODY_CATEGORY_INDEX = 1;
9
+ export declare const BODY_MASK_INDEX = 2;
10
+ export declare const BODY_SIZE = 3;
11
+ export declare const BODY_SHAPE_MASK = 7;
12
+ export declare const BODY_SENSOR_FLAG = 8;
13
+ export declare const BODY_CCD_FLAG = 16;
14
+ export declare const BODY_DYING_FLAG = 32;
15
+ export declare const BODY_BLOCKS_PATH_FLAG = 64;
@@ -9,12 +9,6 @@ export interface BodyComponent {
9
9
  continuousCollisionDetection: boolean;
10
10
  blocksPath: boolean;
11
11
  }
12
- export declare const SHAPE_RECTANGLE = 1;
13
- export declare const SHAPE_CIRCLE = 2;
14
- export declare const SHAPE_CAPSULE = 3;
15
- export declare const SHAPE_POLYGON = 4;
16
- export declare const DEFAULT_COLLIDE_CATEGORY = 1;
17
- export declare const DEFAULT_COLLIDE_MASK = 4294967295;
18
12
  export declare function canCollide(categoryA: number, maskA: number, categoryB: number, maskB: number): boolean;
19
13
  export interface BodyConfig {
20
14
  width?: number;
@@ -28,15 +22,6 @@ export interface BodyConfig {
28
22
  continuousCollisionDetection?: boolean;
29
23
  blocksPath?: boolean;
30
24
  }
31
- export declare const BODY_FLAGS_INDEX = 0;
32
- export declare const BODY_CATEGORY_INDEX = 1;
33
- export declare const BODY_MASK_INDEX = 2;
34
- export declare const BODY_SIZE = 3;
35
- export declare const BODY_SHAPE_MASK = 7;
36
- export declare const BODY_SENSOR_FLAG = 8;
37
- export declare const BODY_CCD_FLAG = 16;
38
- export declare const BODY_DYING_FLAG = 32;
39
- export declare const BODY_BLOCKS_PATH_FLAG = 64;
40
25
  export declare function bodyShape(body: Uint32Array): number;
41
26
  export declare function isSensor(body: Uint32Array): boolean;
42
27
  export declare function isContinuous(body: Uint32Array): boolean;
@@ -0,0 +1,2 @@
1
+ export declare const BOUNCINESS_INDEX = 0;
2
+ export declare const BOUNCINESS_SIZE = 1;
@@ -6,7 +6,5 @@ export interface BouncinessComponent {
6
6
  export interface BouncinessConfig {
7
7
  bounciness?: number;
8
8
  }
9
- export declare const BOUNCINESS_INDEX = 0;
10
- export declare const BOUNCINESS_SIZE = 1;
11
9
  export declare const bouncinessDefinition: ComponentDefinition<BouncinessComponent, Float32Array, BouncinessConfig>;
12
10
  export default bouncinessDefinition;
@@ -0,0 +1,4 @@
1
+ export declare const DYNAMICS_ACCELERATION_X_INDEX = 0;
2
+ export declare const DYNAMICS_ACCELERATION_Y_INDEX = 1;
3
+ export declare const DYNAMICS_INVERSE_MASS_INDEX = 2;
4
+ export declare const DYNAMICS_SIZE = 3;
@@ -11,9 +11,5 @@ export interface DynamicsConfig {
11
11
  mass?: number;
12
12
  }
13
13
  export type DynamicsSerialization = DynamicsConfig;
14
- export declare const DYNAMICS_ACCELERATION_X_INDEX = 0;
15
- export declare const DYNAMICS_ACCELERATION_Y_INDEX = 1;
16
- export declare const DYNAMICS_INVERSE_MASS_INDEX = 2;
17
- export declare const DYNAMICS_SIZE = 3;
18
14
  export declare const dynamicsDefinition: ComponentDefinition<DynamicsComponent, Float32Array, DynamicsConfig, DynamicsSerialization>;
19
15
  export default dynamicsDefinition;
@@ -0,0 +1,18 @@
1
+ export declare const INTERPOLATION_X_INDEX = 0;
2
+ export declare const INTERPOLATION_Y_INDEX = 1;
3
+ export declare const INTERPOLATION_SYNCED_TICK_INDEX = 2;
4
+ export declare const INTERPOLATION_DURATION_INDEX = 3;
5
+ export declare const INTERPOLATION_TICK_INDEX = 4;
6
+ export declare const INTERPOLATION_TOTAL_DURATION_INDEX = 5;
7
+ export declare const INTERPOLATION_SYNCED_DURATION_INDEX = 6;
8
+ export declare const INTERPOLATION_REMAINING_DURATION_INDEX = 7;
9
+ export declare const INTERPOLATION_TARGET_X_INDEX = 8;
10
+ export declare const INTERPOLATION_TARGET_Y_INDEX = 9;
11
+ export declare const INTERPOLATION_SYNCED_STEP_DURATION_INDEX = 10;
12
+ export declare const INTERPOLATION_CHANNEL_INDEX = 11;
13
+ export declare const INTERPOLATION_PREVIOUS_X_INDEX = 12;
14
+ export declare const INTERPOLATION_PREVIOUS_Y_INDEX = 13;
15
+ export declare const INTERPOLATION_PREVIOUS_DURATION_INDEX = 14;
16
+ export declare const INTERPOLATION_PREVIOUS_TOTAL_DURATION_INDEX = 15;
17
+ export declare const INTERPOLATION_PREVIOUS_TICK_INDEX = 16;
18
+ export declare const INTERPOLATION_SIZE = 17;
@@ -1,6 +1,4 @@
1
1
  import type { ComponentDefinition } from '@daneren2005/shared-memory-ecs';
2
- import type { TransformComponent } from './transform-component';
3
- import type { VelocityComponent } from './velocity-component';
4
2
  export interface InterpolationComponent {
5
3
  index: number;
6
4
  x: number;
@@ -22,43 +20,5 @@ export interface InterpolationConfig {
22
20
  x?: number;
23
21
  y?: number;
24
22
  }
25
- export declare const INTERPOLATION_X_INDEX = 0;
26
- export declare const INTERPOLATION_Y_INDEX = 1;
27
- export declare const INTERPOLATION_SYNCED_TICK_INDEX = 2;
28
- export declare const INTERPOLATION_DURATION_INDEX = 3;
29
- export declare const INTERPOLATION_TICK_INDEX = 4;
30
- export declare const INTERPOLATION_TOTAL_DURATION_INDEX = 5;
31
- export declare const INTERPOLATION_SYNCED_DURATION_INDEX = 6;
32
- export declare const INTERPOLATION_REMAINING_DURATION_INDEX = 7;
33
- export declare const INTERPOLATION_TARGET_X_INDEX = 8;
34
- export declare const INTERPOLATION_TARGET_Y_INDEX = 9;
35
- export declare const INTERPOLATION_SYNCED_STEP_DURATION_INDEX = 10;
36
- export declare const INTERPOLATION_CHANNEL_INDEX = 11;
37
- export declare const INTERPOLATION_PREVIOUS_X_INDEX = 12;
38
- export declare const INTERPOLATION_PREVIOUS_Y_INDEX = 13;
39
- export declare const INTERPOLATION_PREVIOUS_DURATION_INDEX = 14;
40
- export declare const INTERPOLATION_PREVIOUS_TOTAL_DURATION_INDEX = 15;
41
- export declare const INTERPOLATION_PREVIOUS_TICK_INDEX = 16;
42
- export declare const INTERPOLATION_SIZE = 17;
43
23
  export declare const interpolationDefinition: ComponentDefinition<InterpolationComponent, Float32Array, InterpolationConfig>;
44
- export interface SnappableEntity {
45
- components: {
46
- transform?: TransformComponent;
47
- interpolation?: InterpolationComponent;
48
- };
49
- }
50
- export declare function snapEntity(entity: SnappableEntity): void;
51
- export interface SpawnableEntity {
52
- components: {
53
- transform?: TransformComponent;
54
- velocity?: VelocityComponent;
55
- interpolation?: InterpolationComponent;
56
- };
57
- }
58
- export interface SpawnInterpolationOptions {
59
- stepMs: number;
60
- stepFraction: number;
61
- tick: number;
62
- }
63
- export declare function startSpawnInterpolation(entity: SpawnableEntity, options: SpawnInterpolationOptions): void;
64
24
  export default interpolationDefinition;
@@ -0,0 +1,4 @@
1
+ export declare const MAX_POLYGON_VERTICES = 16;
2
+ export declare const POLYGON_VERTEX_COUNT_INDEX = 0;
3
+ export declare const POLYGON_VERTICES_INDEX = 1;
4
+ export declare const POLYGON_SIZE: number;
@@ -10,10 +10,6 @@ export interface PolygonComponent {
10
10
  readonly block: Float32Array;
11
11
  readonly vertexCount: number;
12
12
  }
13
- export declare const MAX_POLYGON_VERTICES = 16;
14
- export declare const POLYGON_VERTEX_COUNT_INDEX = 0;
15
- export declare const POLYGON_VERTICES_INDEX = 1;
16
- export declare const POLYGON_SIZE: number;
17
13
  export interface PreparedPolygon {
18
14
  width: number;
19
15
  height: number;
@@ -0,0 +1,6 @@
1
+ export declare const TRANSFORM_X_INDEX = 0;
2
+ export declare const TRANSFORM_Y_INDEX = 1;
3
+ export declare const TRANSFORM_WIDTH_INDEX = 2;
4
+ export declare const TRANSFORM_HEIGHT_INDEX = 3;
5
+ export declare const TRANSFORM_ANGLE_INDEX = 4;
6
+ export declare const TRANSFORM_SIZE = 5;
@@ -18,13 +18,7 @@ export interface TransformConfig {
18
18
  export interface TransformSerialization {
19
19
  x: number;
20
20
  y: number;
21
- angle: number;
21
+ angle?: number;
22
22
  }
23
- export declare const TRANSFORM_X_INDEX = 0;
24
- export declare const TRANSFORM_Y_INDEX = 1;
25
- export declare const TRANSFORM_WIDTH_INDEX = 2;
26
- export declare const TRANSFORM_HEIGHT_INDEX = 3;
27
- export declare const TRANSFORM_ANGLE_INDEX = 4;
28
- export declare const TRANSFORM_SIZE = 5;
29
23
  export declare const transformDefinition: ComponentDefinition<TransformComponent, Float32Array, TransformConfig, TransformSerialization>;
30
24
  export default transformDefinition;
@@ -0,0 +1,4 @@
1
+ export declare const VELOCITY_X_INDEX = 0;
2
+ export declare const VELOCITY_Y_INDEX = 1;
3
+ export declare const VELOCITY_DAMPING_INDEX = 2;
4
+ export declare const VELOCITY_SIZE = 3;
@@ -11,9 +11,5 @@ export interface VelocityConfig {
11
11
  damping?: number;
12
12
  }
13
13
  export type VelocitySerialization = VelocityConfig;
14
- export declare const VELOCITY_X_INDEX = 0;
15
- export declare const VELOCITY_Y_INDEX = 1;
16
- export declare const VELOCITY_DAMPING_INDEX = 2;
17
- export declare const VELOCITY_SIZE = 3;
18
14
  export declare const velocityDefinition: ComponentDefinition<VelocityComponent, Float32Array, VelocityConfig, VelocitySerialization>;
19
15
  export default velocityDefinition;
@@ -0,0 +1,5 @@
1
+ export declare const POSITION_UPDATED_EVENT = "position-updated";
2
+ export declare const COLLIDABLE_QUERY = "collidable";
3
+ export declare const DEFAULT_PHYSICS_STEP_MS = 50;
4
+ export declare const BACKLOG_TARGET_STEPS = 1.5;
5
+ export declare const BACKLOG_CATCHUP_RATE = 0.5;
package/dist/index.d.ts CHANGED
@@ -1,41 +1,50 @@
1
+ export { COLLIDABLE_QUERY, DEFAULT_PHYSICS_STEP_MS, POSITION_UPDATED_EVENT } from './constants';
1
2
  export { default as transformDefinition } from './components/transform-component';
2
- export { TRANSFORM_X_INDEX, TRANSFORM_Y_INDEX, TRANSFORM_WIDTH_INDEX, TRANSFORM_HEIGHT_INDEX, TRANSFORM_ANGLE_INDEX, TRANSFORM_SIZE, } from './components/transform-component';
3
+ export { TRANSFORM_X_INDEX, TRANSFORM_Y_INDEX, TRANSFORM_WIDTH_INDEX, TRANSFORM_HEIGHT_INDEX, TRANSFORM_ANGLE_INDEX, TRANSFORM_SIZE, } from './components/transform-component-constants';
3
4
  export type { TransformComponent, TransformConfig, TransformSerialization, } from './components/transform-component';
4
5
  export { default as velocityDefinition } from './components/velocity-component';
5
- export { VELOCITY_X_INDEX, VELOCITY_Y_INDEX, VELOCITY_DAMPING_INDEX, VELOCITY_SIZE, } from './components/velocity-component';
6
+ export { VELOCITY_X_INDEX, VELOCITY_Y_INDEX, VELOCITY_DAMPING_INDEX, VELOCITY_SIZE, } from './components/velocity-component-constants';
6
7
  export type { VelocityComponent, VelocityConfig, VelocitySerialization, } from './components/velocity-component';
7
8
  export { default as dynamicsDefinition } from './components/dynamics-component';
8
- export { DYNAMICS_ACCELERATION_X_INDEX, DYNAMICS_ACCELERATION_Y_INDEX, DYNAMICS_INVERSE_MASS_INDEX, DYNAMICS_SIZE, } from './components/dynamics-component';
9
+ export { DYNAMICS_ACCELERATION_X_INDEX, DYNAMICS_ACCELERATION_Y_INDEX, DYNAMICS_INVERSE_MASS_INDEX, DYNAMICS_SIZE, } from './components/dynamics-component-constants';
9
10
  export type { DynamicsComponent, DynamicsConfig, DynamicsSerialization, } from './components/dynamics-component';
10
11
  export { default as bodyDefinition, canCollide, isSensor, isContinuous, blocksPath, isDying, markDying, bodyShape } from './components/body-component';
11
- export { SHAPE_RECTANGLE, SHAPE_CIRCLE, SHAPE_CAPSULE, SHAPE_POLYGON, DEFAULT_COLLIDE_CATEGORY, DEFAULT_COLLIDE_MASK, BODY_FLAGS_INDEX, BODY_SHAPE_MASK, BODY_SENSOR_FLAG, BODY_CCD_FLAG, BODY_DYING_FLAG, BODY_BLOCKS_PATH_FLAG, BODY_CATEGORY_INDEX, BODY_MASK_INDEX, BODY_SIZE, } from './components/body-component';
12
+ export { SHAPE_RECTANGLE, SHAPE_CIRCLE, SHAPE_CAPSULE, SHAPE_POLYGON, DEFAULT_COLLIDE_CATEGORY, DEFAULT_COLLIDE_MASK, BODY_FLAGS_INDEX, BODY_SHAPE_MASK, BODY_SENSOR_FLAG, BODY_CCD_FLAG, BODY_DYING_FLAG, BODY_BLOCKS_PATH_FLAG, BODY_CATEGORY_INDEX, BODY_MASK_INDEX, BODY_SIZE, } from './components/body-component-constants';
12
13
  export type { BodyComponent, BodyConfig, } from './components/body-component';
13
14
  export { default as polygonDefinition, preparePolygon } from './components/polygon-component';
14
- export { MAX_POLYGON_VERTICES, POLYGON_VERTEX_COUNT_INDEX, POLYGON_VERTICES_INDEX, POLYGON_SIZE, } from './components/polygon-component';
15
+ export { MAX_POLYGON_VERTICES, POLYGON_VERTEX_COUNT_INDEX, POLYGON_VERTICES_INDEX, POLYGON_SIZE, } from './components/polygon-component-constants';
15
16
  export type { PolygonComponent, PolygonConfig, PolygonVertex, PreparedPolygon } from './components/polygon-component';
16
17
  export { default as bouncinessDefinition } from './components/bounciness-component';
17
- export { BOUNCINESS_INDEX, BOUNCINESS_SIZE, } from './components/bounciness-component';
18
+ export { BOUNCINESS_INDEX, BOUNCINESS_SIZE, } from './components/bounciness-component-constants';
18
19
  export type { BouncinessComponent, BouncinessConfig, } from './components/bounciness-component';
19
- export { default as interpolationDefinition, snapEntity, startSpawnInterpolation } from './components/interpolation-component';
20
- export { INTERPOLATION_X_INDEX, INTERPOLATION_Y_INDEX, INTERPOLATION_SYNCED_TICK_INDEX, INTERPOLATION_DURATION_INDEX, INTERPOLATION_TICK_INDEX, INTERPOLATION_TOTAL_DURATION_INDEX, INTERPOLATION_SYNCED_DURATION_INDEX, INTERPOLATION_REMAINING_DURATION_INDEX, INTERPOLATION_TARGET_X_INDEX, INTERPOLATION_TARGET_Y_INDEX, INTERPOLATION_SYNCED_STEP_DURATION_INDEX, INTERPOLATION_CHANNEL_INDEX, INTERPOLATION_PREVIOUS_X_INDEX, INTERPOLATION_PREVIOUS_Y_INDEX, INTERPOLATION_PREVIOUS_DURATION_INDEX, INTERPOLATION_PREVIOUS_TOTAL_DURATION_INDEX, INTERPOLATION_PREVIOUS_TICK_INDEX, INTERPOLATION_SIZE, } from './components/interpolation-component';
21
- export type { InterpolationComponent, InterpolationConfig, SnappableEntity, SpawnableEntity, SpawnInterpolationOptions, } from './components/interpolation-component';
20
+ export { default as interpolationDefinition } from './components/interpolation-component';
21
+ export { INTERPOLATION_X_INDEX, INTERPOLATION_Y_INDEX, INTERPOLATION_SYNCED_TICK_INDEX, INTERPOLATION_DURATION_INDEX, INTERPOLATION_TICK_INDEX, INTERPOLATION_TOTAL_DURATION_INDEX, INTERPOLATION_SYNCED_DURATION_INDEX, INTERPOLATION_REMAINING_DURATION_INDEX, INTERPOLATION_TARGET_X_INDEX, INTERPOLATION_TARGET_Y_INDEX, INTERPOLATION_SYNCED_STEP_DURATION_INDEX, INTERPOLATION_CHANNEL_INDEX, INTERPOLATION_PREVIOUS_X_INDEX, INTERPOLATION_PREVIOUS_Y_INDEX, INTERPOLATION_PREVIOUS_DURATION_INDEX, INTERPOLATION_PREVIOUS_TOTAL_DURATION_INDEX, INTERPOLATION_PREVIOUS_TICK_INDEX, INTERPOLATION_SIZE, } from './components/interpolation-component-constants';
22
+ export type { InterpolationComponent, InterpolationConfig, } from './components/interpolation-component';
22
23
  export { physicsRegistry } from './components/registry';
23
24
  export type { PhysicsComponents, PhysicsUpdateComponents, InterpolationComponents, InterpolationUpdateComponents, } from './components/registry';
24
- export { default as PhysicalWorld, addPhysicalWorldData, getSpatialMap } from './world';
25
+ export { default as PhysicalWorld } from './world';
25
26
  export type { PhysicalSystemWorld, PhysicalWorldData, PhysicalWorldSource, PhysicalWorldEntity, PhysicalWorldFilter, PhysicalWorldOptions, } from './world';
26
27
  export { shapesOverlap, contactNormal, shapeHalfWidth, shapeHalfHeight, shapeIsEmpty, shapeRadius, capsuleHalfLength, capsuleCoreAngle, boundsHalfWidth, boundsHalfHeight, orientedBoxesOverlap, segmentSegmentDistanceSquared, segmentBoxDistanceSquared, pointSegmentDistanceSquared, } from './math/shapes';
27
28
  export type { Vector } from './math/shapes';
28
29
  export { polygonShapesOverlap, polygonContactNormal } from './math/polygons';
29
- export { default as CollisionBroadphase, COLLIDABLE_QUERY } from './systems/collision';
30
+ export { default as CollisionBroadphase } from './systems/collision';
30
31
  export type { CollisionComponents, CollisionContact, CollisionEntity, CollisionFunction, MoveResult, MovingEntity, SweepResult } from './systems/collision';
31
32
  export { default as SpatialIndex } from './systems/spatial-index';
32
33
  export type { SpatialComponents, SpatialEntity, SpatialFilter } from './systems/spatial-index';
33
- export { default as physicsUpdate, createPhysicsUpdate, POSITION_UPDATED_EVENT, updateSpatialMap } from './systems/physics-update';
34
+ export { setEntityPosition } from './actions/set-entity-position';
35
+ export { updateSpatialMap } from './actions/update-spatial-map';
36
+ export { getSpatialMap } from './actions/get-spatial-map';
37
+ export { addPhysicalWorldData } from './actions/add-physical-world-data';
38
+ export { snapEntity } from './actions/snap-entity';
39
+ export type { SnappableEntity } from './actions/snap-entity';
40
+ export { startSpawnInterpolation } from './actions/start-spawn-interpolation';
41
+ export type { SpawnableEntity, SpawnInterpolationOptions } from './actions/start-spawn-interpolation';
42
+ export { default as integrateDynamics } from './actions/integrate-dynamics';
43
+ export type { DynamicsCommand, DynamicsCommandBuffer, DynamicsCommandQueue, DynamicsCommands, DynamicsWorld } from './actions/dynamics-commands';
44
+ export { default as physicsUpdate, createPhysicsUpdate } from './systems/physics-update';
34
45
  export type { DeathInterpolationEntity, PhysicsCallbackWorld, PhysicsGroupConfig, PhysicsUpdateFunction, PhysicsUpdateMetadata, PhysicsUpdateOptions, PhysicsWorld } from './systems/physics-update';
35
- export { default as PhysicsSystem, DEFAULT_PHYSICS_STEP_MS } from './systems/physics-system';
46
+ export { default as PhysicsSystem } from './systems/physics-system';
36
47
  export type { PhysicsSystemConfig, VelocityAssignment } from './systems/physics-system';
37
- export { default as integrateDynamics } from './systems/dynamics';
38
- export type { DynamicsCommand, DynamicsCommandBuffer, DynamicsCommandQueue, DynamicsCommands, DynamicsWorld } from './systems/dynamics';
39
48
  export { default as interpolationUpdate } from './systems/interpolation-update';
40
49
  export type { InterpolationWorld } from './systems/interpolation-update';
41
50
  export { default as InterpolationSystem } from './systems/interpolation-system';