@daneren2005/shared-memory-physics 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +227 -32
- package/dist/components/body-component.d.ts +9 -3
- package/dist/components/dynamics-component.d.ts +19 -0
- package/dist/components/polygon-component.d.ts +22 -0
- package/dist/components/registry.d.ts +8 -0
- package/dist/components/transform-component.d.ts +2 -0
- package/dist/components/velocity-component.d.ts +4 -1
- package/dist/index.d.ts +18 -7
- package/dist/index.js +833 -275
- package/dist/index.js.map +1 -1
- package/dist/math/polygons.d.ts +3 -0
- package/dist/systems/bounce.d.ts +2 -1
- package/dist/systems/collision.d.ts +31 -3
- package/dist/systems/dynamics.d.ts +43 -0
- package/dist/systems/interpolation-system.d.ts +2 -2
- package/dist/systems/physics-system.d.ts +16 -5
- package/dist/systems/physics-update.d.ts +22 -4
- package/dist/systems/spatial-bounds.d.ts +13 -0
- package/dist/world.d.ts +30 -0
- package/package.json +5 -4
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Vector } from './shapes';
|
|
2
|
+
export declare function polygonShapesOverlap(aShape: number, aPolygon: Float32Array | undefined, aX: number, aY: number, aWidth: number, aHeight: number, aAngle: number, bShape: number, bPolygon: Float32Array | undefined, bX: number, bY: number, bWidth: number, bHeight: number, bAngle: number): boolean;
|
|
3
|
+
export declare function polygonContactNormal(aShape: number, aPolygon: Float32Array | undefined, aX: number, aY: number, aWidth: number, aHeight: number, aAngle: number, bShape: number, bPolygon: Float32Array | undefined, bX: number, bY: number, bWidth: number, bHeight: number, bAngle: number, out: Vector): boolean;
|
package/dist/systems/bounce.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ interface BounceEntity {
|
|
|
4
4
|
velocity?: Float32Array;
|
|
5
5
|
bounciness?: Float32Array;
|
|
6
6
|
body?: Uint32Array;
|
|
7
|
+
polygon?: Float32Array;
|
|
7
8
|
};
|
|
8
9
|
}
|
|
9
|
-
export declare function bouncePair(self: BounceEntity, other: BounceEntity): void;
|
|
10
|
+
export declare function bouncePair(self: BounceEntity, other: BounceEntity, stopNonBouncing?: boolean): void;
|
|
10
11
|
export declare function bounce(self: BounceEntity, other: BounceEntity): void;
|
|
11
12
|
export default bounce;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { ComponentMap,
|
|
1
|
+
import type { ComponentMap, EntityWorkerSystemCallbacks, EntityWorkerSystemWorld, EntityQueryComponents, EntityUpdateComponents } from '@daneren2005/shared-memory-ecs';
|
|
2
2
|
import type { PhysicsUpdateComponents } from '../components/registry';
|
|
3
|
+
import type { Vector } from '../math/shapes';
|
|
4
|
+
import type { DynamicsCommands } from './dynamics';
|
|
3
5
|
export declare const COLLIDABLE_QUERY = "collidable";
|
|
4
6
|
export type CollisionComponents<T extends PhysicsUpdateComponents> = Partial<T> & {
|
|
5
7
|
transform: Float32Array;
|
|
6
8
|
body: Uint32Array;
|
|
9
|
+
polygon?: Float32Array;
|
|
7
10
|
entity?: Uint32Array;
|
|
8
11
|
};
|
|
9
12
|
export interface MovingEntity<T extends PhysicsUpdateComponents> {
|
|
@@ -14,7 +17,11 @@ export interface CollisionEntity<T extends PhysicsUpdateComponents> {
|
|
|
14
17
|
entityId: number;
|
|
15
18
|
components: CollisionComponents<T>;
|
|
16
19
|
}
|
|
17
|
-
export
|
|
20
|
+
export interface CollisionContact {
|
|
21
|
+
normalX: number;
|
|
22
|
+
normalY: number;
|
|
23
|
+
}
|
|
24
|
+
export type CollisionFunction<C extends ComponentMap, T extends PhysicsUpdateComponents & EntityUpdateComponents<C>, W extends EntityWorkerSystemWorld = EntityWorkerSystemWorld> = (world: W, self: MovingEntity<T>, other: CollisionEntity<T>, queries: EntityQueryComponents<C>, callbacks: EntityWorkerSystemCallbacks<C>, contact: CollisionContact) => void;
|
|
18
25
|
export interface SweepResult<T extends PhysicsUpdateComponents> {
|
|
19
26
|
fraction: number;
|
|
20
27
|
blocking: Array<CollisionEntity<T>>;
|
|
@@ -24,6 +31,21 @@ export interface MoveResult<T extends PhysicsUpdateComponents> {
|
|
|
24
31
|
moveY: number;
|
|
25
32
|
blocking: Array<CollisionEntity<T>>;
|
|
26
33
|
}
|
|
34
|
+
interface ContactSource {
|
|
35
|
+
entityId: number;
|
|
36
|
+
components: {
|
|
37
|
+
transform: Float32Array;
|
|
38
|
+
body?: Uint32Array;
|
|
39
|
+
polygon?: Float32Array;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
interface ContactTarget {
|
|
43
|
+
components: {
|
|
44
|
+
transform: Float32Array;
|
|
45
|
+
body: Uint32Array;
|
|
46
|
+
polygon?: Float32Array;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
27
49
|
export default class CollisionBroadphase<T extends PhysicsUpdateComponents> {
|
|
28
50
|
private buckets;
|
|
29
51
|
readonly hasBounciness: boolean;
|
|
@@ -31,9 +53,14 @@ export default class CollisionBroadphase<T extends PhysicsUpdateComponents> {
|
|
|
31
53
|
constructor(entities: Array<{
|
|
32
54
|
entityId: number;
|
|
33
55
|
components: EntityUpdateComponents;
|
|
34
|
-
}>, seconds: number);
|
|
56
|
+
}>, seconds: number, dynamicsCommands?: DynamicsCommands);
|
|
35
57
|
claimContact(a: number, b: number): boolean;
|
|
36
58
|
forEachOverlapping(self: MovingEntity<T>, handle: (other: CollisionEntity<T>) => void, moveX?: number, moveY?: number): void;
|
|
59
|
+
contactPoint(self: ContactSource, other: ContactTarget, moveX: number, moveY: number): {
|
|
60
|
+
x: number;
|
|
61
|
+
y: number;
|
|
62
|
+
};
|
|
63
|
+
contactNormal(self: ContactSource, other: ContactTarget, moveX: number, moveY: number, out: Vector): boolean;
|
|
37
64
|
sweep(self: MovingEntity<T>, moveX: number, moveY: number): SweepResult<T>;
|
|
38
65
|
resolveMove(self: MovingEntity<T>, moveX: number, moveY: number, slide: boolean): MoveResult<T>;
|
|
39
66
|
private gatherCandidates;
|
|
@@ -45,3 +72,4 @@ export default class CollisionBroadphase<T extends PhysicsUpdateComponents> {
|
|
|
45
72
|
private blockedAt;
|
|
46
73
|
private forEachCandidate;
|
|
47
74
|
}
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface DynamicsCommand {
|
|
2
|
+
entityId: number;
|
|
3
|
+
forceX: number;
|
|
4
|
+
forceY: number;
|
|
5
|
+
impulseX: number;
|
|
6
|
+
impulseY: number;
|
|
7
|
+
velocityX?: number;
|
|
8
|
+
velocityY?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface VelocityAssignment {
|
|
11
|
+
velocityX?: number;
|
|
12
|
+
velocityY?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface DynamicsCommandQueue {
|
|
15
|
+
queueForce(entityId: number, forceX: number, forceY: number): void;
|
|
16
|
+
queueImpulse(entityId: number, impulseX: number, impulseY: number): void;
|
|
17
|
+
queueVelocity(entityId: number, velocity: VelocityAssignment): void;
|
|
18
|
+
}
|
|
19
|
+
export type PendingDynamicsCommands = Map<number, Omit<DynamicsCommand, 'entityId'>>;
|
|
20
|
+
export type DynamicsCommandBuffer = Float64Array;
|
|
21
|
+
export type DynamicsCommands = DynamicsCommandBuffer | ReadonlyArray<DynamicsCommand>;
|
|
22
|
+
export declare const DYNAMICS_COMMAND_STRIDE = 8;
|
|
23
|
+
export declare const DYNAMICS_COMMAND_ENTITY_ID_OFFSET = 0;
|
|
24
|
+
export declare const DYNAMICS_COMMAND_FORCE_X_OFFSET = 1;
|
|
25
|
+
export declare const DYNAMICS_COMMAND_FORCE_Y_OFFSET = 2;
|
|
26
|
+
export declare const DYNAMICS_COMMAND_IMPULSE_X_OFFSET = 3;
|
|
27
|
+
export declare const DYNAMICS_COMMAND_IMPULSE_Y_OFFSET = 4;
|
|
28
|
+
export declare const DYNAMICS_COMMAND_VELOCITY_MASK_OFFSET = 5;
|
|
29
|
+
export declare const DYNAMICS_COMMAND_VELOCITY_X_OFFSET = 6;
|
|
30
|
+
export declare const DYNAMICS_COMMAND_VELOCITY_Y_OFFSET = 7;
|
|
31
|
+
export declare const DYNAMICS_COMMAND_VELOCITY_X_FLAG: number;
|
|
32
|
+
export declare const DYNAMICS_COMMAND_VELOCITY_Y_FLAG: number;
|
|
33
|
+
export interface DynamicsWorld {
|
|
34
|
+
elapsedTime: number;
|
|
35
|
+
dynamicsCommands?: DynamicsCommands;
|
|
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;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EntityWorkerSystem } from '@daneren2005/shared-memory-ecs';
|
|
2
2
|
import type { BaseWorld, ComponentDefinitionMap, ComponentMap, EntityUpdateComponents, SystemConfig } from '@daneren2005/shared-memory-ecs';
|
|
3
3
|
import type { InterpolationComponents, InterpolationUpdateComponents } from '../components/registry';
|
|
4
4
|
export interface InterpolationSystemConfig extends Partial<SystemConfig> {
|
|
5
5
|
forceMainThread?: boolean;
|
|
6
6
|
getWorker?: () => Worker;
|
|
7
7
|
}
|
|
8
|
-
export default class InterpolationSystem<C extends ComponentMap & InterpolationComponents> extends
|
|
8
|
+
export default class InterpolationSystem<C extends ComponentMap & InterpolationComponents> extends EntityWorkerSystem<C, InterpolationUpdateComponents & EntityUpdateComponents<C>> {
|
|
9
9
|
constructor(world: BaseWorld<ComponentDefinitionMap, C>, options?: InterpolationSystemConfig);
|
|
10
10
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { BaseEntity, BaseWorld, ComponentDefinitionMap, ComponentMap,
|
|
1
|
+
import { EntityWorkerSystem } from '@daneren2005/shared-memory-ecs';
|
|
2
|
+
import type { BaseEntity, BaseWorld, ComponentDefinitionMap, ComponentMap, EntityWorkerSystemQuery, EntityUpdateComponents, EntityUpdateFunction, SystemConfig } from '@daneren2005/shared-memory-ecs';
|
|
3
3
|
import { type SpawnableEntity } from '../components/interpolation-component';
|
|
4
4
|
import type { PhysicsComponents, PhysicsUpdateComponents } from '../components/registry';
|
|
5
5
|
import { type PhysicsUpdateMetadata, type PhysicsWorld } from './physics-update';
|
|
6
|
+
import { type PhysicalWorldSource } from '../world';
|
|
7
|
+
import type { VelocityAssignment } from './dynamics';
|
|
6
8
|
export declare const DEFAULT_PHYSICS_STEP_MS = 50;
|
|
9
|
+
export type { VelocityAssignment } from './dynamics';
|
|
7
10
|
export interface PhysicsSystemConfig<C extends ComponentMap & PhysicsComponents, T extends PhysicsUpdateComponents & EntityUpdateComponents<C>, W extends PhysicsWorld = PhysicsWorld> extends Partial<SystemConfig> {
|
|
8
11
|
getWorker?: () => Worker;
|
|
9
12
|
forceMainThread?: boolean;
|
|
@@ -16,15 +19,23 @@ export interface PhysicsSystemConfig<C extends ComponentMap & PhysicsComponents,
|
|
|
16
19
|
filter?: (entity: BaseEntity<C>) => boolean;
|
|
17
20
|
scope?: (entity: BaseEntity<C>) => boolean;
|
|
18
21
|
queries?: {
|
|
19
|
-
[key: string]:
|
|
22
|
+
[key: string]: EntityWorkerSystemQuery<C>;
|
|
20
23
|
};
|
|
21
24
|
skipGroup?: number;
|
|
22
25
|
}
|
|
23
|
-
export default class PhysicsSystem<C extends ComponentMap & PhysicsComponents, T extends PhysicsUpdateComponents & EntityUpdateComponents<C> = PhysicsUpdateComponents & EntityUpdateComponents<C>, W extends PhysicsWorld = PhysicsWorld> extends
|
|
26
|
+
export default class PhysicsSystem<C extends ComponentMap & PhysicsComponents, T extends PhysicsUpdateComponents & EntityUpdateComponents<C> = PhysicsUpdateComponents & EntityUpdateComponents<C>, W extends PhysicsWorld = PhysicsWorld> extends EntityWorkerSystem<C, T, W> {
|
|
27
|
+
private spatialWorld;
|
|
28
|
+
private pendingDynamicsCommands;
|
|
29
|
+
private readonly commandQueueId;
|
|
24
30
|
tick: number;
|
|
25
31
|
reportMoves: boolean | undefined;
|
|
26
32
|
skipGroup: number | undefined;
|
|
27
|
-
constructor(world: BaseWorld<ComponentDefinitionMap, C
|
|
33
|
+
constructor(world: BaseWorld<ComponentDefinitionMap, C> & PhysicalWorldSource, options?: PhysicsSystemConfig<C, T, W>);
|
|
28
34
|
startInterpolation(entity: SpawnableEntity): void;
|
|
35
|
+
queueForce(entity: BaseEntity<C> | number, forceX: number, forceY: number): void;
|
|
36
|
+
queueImpulse(entity: BaseEntity<C> | number, impulseX: number, impulseY: number): void;
|
|
37
|
+
queueVelocity(entity: BaseEntity<C> | number, velocity: VelocityAssignment): void;
|
|
29
38
|
addDataToWorld(world: W): void;
|
|
39
|
+
private queueDynamics;
|
|
40
|
+
private snapshotDynamicsCommands;
|
|
30
41
|
}
|
|
@@ -1,16 +1,33 @@
|
|
|
1
|
-
import type { ComponentMap,
|
|
1
|
+
import type { ComponentMap, EntityWorkerSystemCallbacks, EntityWorkerSystemWorld, EntityQueryComponents, EntityUpdateComponents, EntityUpdateFunction } from '@daneren2005/shared-memory-ecs';
|
|
2
2
|
import type { PhysicsComponents, PhysicsUpdateComponents } from '../components/registry';
|
|
3
3
|
import { type CollisionFunction } from './collision';
|
|
4
|
-
|
|
4
|
+
import type { DynamicsCommandQueue, DynamicsWorld } from './dynamics';
|
|
5
|
+
import { type SpatialBlockComponents } from './spatial-bounds';
|
|
6
|
+
import { type PhysicalSystemWorld } from '../world';
|
|
7
|
+
export interface PhysicsWorld extends EntityWorkerSystemWorld, PhysicalSystemWorld, DynamicsWorld {
|
|
5
8
|
tick: number;
|
|
6
9
|
reportMoves?: boolean;
|
|
7
10
|
skipGroup?: number;
|
|
11
|
+
commandQueueId?: number;
|
|
12
|
+
dieAtImpact?(dying: DeathInterpolationEntity, other: DeathInterpolationEntity): void;
|
|
13
|
+
}
|
|
14
|
+
export interface PhysicsCallbackWorld extends PhysicsWorld, DynamicsCommandQueue {
|
|
15
|
+
}
|
|
16
|
+
export declare function updateSpatialMap(world: PhysicalSystemWorld, entityId: number, components: SpatialBlockComponents): void;
|
|
17
|
+
export interface DeathInterpolationEntity {
|
|
18
|
+
entityId: number;
|
|
19
|
+
components: {
|
|
20
|
+
transform?: Float32Array;
|
|
21
|
+
velocity?: Float32Array;
|
|
22
|
+
body?: Uint32Array;
|
|
23
|
+
};
|
|
8
24
|
}
|
|
9
25
|
export declare const POSITION_UPDATED_EVENT = "position-updated";
|
|
10
26
|
export interface PhysicsUpdateOptions<C extends ComponentMap, T extends PhysicsUpdateComponents & EntityUpdateComponents<C>, W extends PhysicsWorld = PhysicsWorld> {
|
|
11
|
-
onCollision?: CollisionFunction<C, T, W>;
|
|
27
|
+
onCollision?: CollisionFunction<C, T, W & PhysicsCallbackWorld>;
|
|
12
28
|
optional?: Array<keyof C & string>;
|
|
13
29
|
group?: PhysicsGroupConfig<C>;
|
|
30
|
+
stopVelocityOnContact?: boolean;
|
|
14
31
|
}
|
|
15
32
|
export interface PhysicsGroupConfig<C extends ComponentMap> {
|
|
16
33
|
component: keyof C & string;
|
|
@@ -18,6 +35,7 @@ export interface PhysicsGroupConfig<C extends ComponentMap> {
|
|
|
18
35
|
}
|
|
19
36
|
export interface PhysicsUpdateMetadata<C extends ComponentMap> {
|
|
20
37
|
collision: boolean;
|
|
38
|
+
dynamics: boolean;
|
|
21
39
|
optional: Array<keyof C & string>;
|
|
22
40
|
group?: PhysicsGroupConfig<C>;
|
|
23
41
|
}
|
|
@@ -25,5 +43,5 @@ export type PhysicsUpdateFunction<C extends ComponentMap, T extends PhysicsUpdat
|
|
|
25
43
|
physics: PhysicsUpdateMetadata<C>;
|
|
26
44
|
};
|
|
27
45
|
export declare function createPhysicsUpdate<C extends ComponentMap & PhysicsComponents = PhysicsComponents, T extends PhysicsUpdateComponents & EntityUpdateComponents<C> = PhysicsUpdateComponents & EntityUpdateComponents<C>, W extends PhysicsWorld = PhysicsWorld>(options?: PhysicsUpdateOptions<C, T, W>): PhysicsUpdateFunction<C, T, W>;
|
|
28
|
-
export declare function physicsUpdate<C extends ComponentMap & PhysicsComponents = PhysicsComponents, T extends PhysicsUpdateComponents & EntityUpdateComponents<C> = PhysicsUpdateComponents & EntityUpdateComponents<C>, W extends PhysicsWorld = PhysicsWorld>(world: W, entityId: number, components: T, queries: EntityQueryComponents<C>, callbacks:
|
|
46
|
+
export declare function physicsUpdate<C extends ComponentMap & PhysicsComponents = PhysicsComponents, T extends PhysicsUpdateComponents & EntityUpdateComponents<C> = PhysicsUpdateComponents & EntityUpdateComponents<C>, W extends PhysicsWorld = PhysicsWorld>(world: W, entityId: number, components: T, queries: EntityQueryComponents<C>, callbacks: EntityWorkerSystemCallbacks<C>): void;
|
|
29
47
|
export default physicsUpdate;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SpatialBounds {
|
|
2
|
+
minX: number;
|
|
3
|
+
minY: number;
|
|
4
|
+
maxX: number;
|
|
5
|
+
maxY: number;
|
|
6
|
+
}
|
|
7
|
+
export interface SpatialBlockComponents {
|
|
8
|
+
transform: Float32Array;
|
|
9
|
+
body?: Uint32Array;
|
|
10
|
+
}
|
|
11
|
+
export declare function spatialBounds(components: SpatialBlockComponents): SpatialBounds;
|
|
12
|
+
export declare function boundsOverlap(a: SpatialBounds, minX: number, minY: number, maxX: number, maxY: number): boolean;
|
|
13
|
+
export declare function querySize(min: number, max: number): number;
|
package/dist/world.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import SharedSpatialMap from '@daneren2005/shared-memory-objects/spatial/shared-spatial-map';
|
|
2
|
+
import type { SharedSpatialMapConfig, SharedSpatialMapMemory } from '@daneren2005/shared-memory-objects/spatial/shared-spatial-map';
|
|
3
|
+
import { BaseWorld } from '@daneren2005/shared-memory-ecs';
|
|
4
|
+
import type { BaseEntity, ComponentDefinitionMap, ComponentsOf, EntityWorkerSystemWorld, EntityConfigOf, WorldOptions } from '@daneren2005/shared-memory-ecs';
|
|
5
|
+
export interface PhysicalWorldData {
|
|
6
|
+
spatialMapMemory?: SharedSpatialMapMemory;
|
|
7
|
+
}
|
|
8
|
+
export interface PhysicalSystemWorld extends EntityWorkerSystemWorld, PhysicalWorldData {
|
|
9
|
+
spatialMap?: SharedSpatialMap;
|
|
10
|
+
}
|
|
11
|
+
export interface PhysicalWorldSource {
|
|
12
|
+
spatialMap: SharedSpatialMap;
|
|
13
|
+
}
|
|
14
|
+
export type PhysicalWorldOptions<R extends ComponentDefinitionMap> = WorldOptions<ComponentsOf<R>, EntityConfigOf<R>> & {
|
|
15
|
+
spatial?: SharedSpatialMapConfig;
|
|
16
|
+
};
|
|
17
|
+
export type PhysicalWorldEntity<R extends ComponentDefinitionMap> = BaseEntity<ComponentsOf<R>, EntityConfigOf<R>>;
|
|
18
|
+
export type PhysicalWorldFilter<R extends ComponentDefinitionMap> = (entity: PhysicalWorldEntity<R>) => boolean;
|
|
19
|
+
export declare function addPhysicalWorldData(source: PhysicalWorldSource, target: PhysicalWorldData): void;
|
|
20
|
+
export declare function getSpatialMap(world: PhysicalSystemWorld): SharedSpatialMap;
|
|
21
|
+
export default class PhysicalWorld<R extends ComponentDefinitionMap> extends BaseWorld<R> implements PhysicalWorldSource {
|
|
22
|
+
readonly spatialMap: SharedSpatialMap;
|
|
23
|
+
private spatialIds;
|
|
24
|
+
constructor(registry: R, options?: PhysicalWorldOptions<R>);
|
|
25
|
+
updateSpatialEntity(entityOrId: PhysicalWorldEntity<R> | number): void;
|
|
26
|
+
searchSpatial(minX: number, minY: number, maxX: number, maxY: number, filter?: PhysicalWorldFilter<R>): Array<PhysicalWorldEntity<R>>;
|
|
27
|
+
searchSpatialAround(x: number, y: number, reachX: number, reachY: number, filter?: PhysicalWorldFilter<R>): Array<PhysicalWorldEntity<R>>;
|
|
28
|
+
findNearestSpatial(x: number, y: number, maxDistance?: number, filter?: PhysicalWorldFilter<R>): PhysicalWorldEntity<R> | undefined;
|
|
29
|
+
findNearbySpatial(x: number, y: number, maxResults: number, maxDistance?: number, filter?: PhysicalWorldFilter<R>): Array<PhysicalWorldEntity<R>>;
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@daneren2005/shared-memory-physics",
|
|
3
3
|
"description": "2D physics components and systems built on the shared-memory ECS.",
|
|
4
4
|
"author": "Scott Jackson",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.6.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"repository": {
|
|
@@ -36,12 +36,13 @@
|
|
|
36
36
|
"lint": "cross-env NODE_ENV=production oxlint .",
|
|
37
37
|
"lint:fix": "cross-env NODE_ENV=production oxlint --fix .",
|
|
38
38
|
"test": "vitest run",
|
|
39
|
+
"benchmark": "vitest bench --run",
|
|
39
40
|
"release": "semantic-release",
|
|
40
41
|
"prepare": "husky"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@daneren2005/shared-memory-ecs": "^1.
|
|
44
|
-
"@daneren2005/shared-memory-objects": "^1.
|
|
44
|
+
"@daneren2005/shared-memory-ecs": "^1.6.0",
|
|
45
|
+
"@daneren2005/shared-memory-objects": "^1.5.0",
|
|
45
46
|
"@semantic-release/git": "^10.0.1",
|
|
46
47
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
47
48
|
"@types/node": "^26.1.1",
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
"vitest": "^4.1.10"
|
|
59
60
|
},
|
|
60
61
|
"peerDependencies": {
|
|
61
|
-
"@daneren2005/shared-memory-ecs": "^1.
|
|
62
|
+
"@daneren2005/shared-memory-ecs": "^1.5.1",
|
|
62
63
|
"@daneren2005/shared-memory-objects": "^1.1.0"
|
|
63
64
|
},
|
|
64
65
|
"dependencies": {
|