@ue-too/dynamics 0.6.0 → 0.7.1
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 +7 -0
- package/benchmark.d.ts +47 -0
- package/collision-filter.d.ts +17 -0
- package/collision.d.ts +23 -2
- package/dynamic-tree.d.ts +57 -0
- package/dynamics.tsbuildinfo +1 -1
- package/ecs-version/collision-system.d.ts +36 -0
- package/ecs-version/component.d.ts +40 -0
- package/ecs-version/index.d.ts +4 -0
- package/ecs-version/physics-system.d.ts +9 -0
- package/ecs-version/render-system.d.ts +8 -0
- package/index.d.ts +8 -0
- package/index.js +2248 -8
- package/index.js.map +1 -1
- package/package.json +3 -2
- package/pair-manager.d.ts +41 -0
- package/quadtree.d.ts +6 -5
- package/rigidbody.d.ts +33 -4
- package/simple-benchmark-runner.d.ts +2 -0
- package/world.d.ts +20 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Coordinator, Entity, System } from "@ue-too/ecs";
|
|
2
|
+
import { RigidBodyComponent } from "./component";
|
|
3
|
+
import { Point } from "@ue-too/math";
|
|
4
|
+
export declare class CollisionSystem implements System {
|
|
5
|
+
private coordinator;
|
|
6
|
+
private quadTree;
|
|
7
|
+
entities: Set<Entity>;
|
|
8
|
+
constructor(coordinator: Coordinator);
|
|
9
|
+
constructQuadTree(): void;
|
|
10
|
+
broadPhase(): {
|
|
11
|
+
entityA: Entity;
|
|
12
|
+
entityB: Entity;
|
|
13
|
+
}[];
|
|
14
|
+
narrowPhase(possibleCombinations: {
|
|
15
|
+
entityA: Entity;
|
|
16
|
+
entityB: Entity;
|
|
17
|
+
}[]): void;
|
|
18
|
+
update(deltaTime: number): void;
|
|
19
|
+
}
|
|
20
|
+
export declare function getVerticesAbsCoordRaw(vertices: Point[], center: Point, orientationAngle: number): Point[];
|
|
21
|
+
export declare function updateAABBForPolygon(subjectBody: RigidBodyComponent): {
|
|
22
|
+
min: Point;
|
|
23
|
+
max: Point;
|
|
24
|
+
};
|
|
25
|
+
export declare function updateAABBForPolygonRaw(vertices: Point[], center: Point, orientationAngle: number): {
|
|
26
|
+
min: Point;
|
|
27
|
+
max: Point;
|
|
28
|
+
};
|
|
29
|
+
export declare function updateAABBForCircle(subjectBody: RigidBodyComponent): {
|
|
30
|
+
min: Point;
|
|
31
|
+
max: Point;
|
|
32
|
+
};
|
|
33
|
+
export declare function updateAABB(subjectBody: RigidBodyComponent): {
|
|
34
|
+
min: Point;
|
|
35
|
+
max: Point;
|
|
36
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Point } from "@ue-too/math";
|
|
2
|
+
export declare const RIGID_BODY_COMPONENT = "RigidBodyComponent";
|
|
3
|
+
export declare const PHYSICS_COMPONENT = "PhysicsComponent";
|
|
4
|
+
export declare const RENDER_COMPONENT = "RenderComponent";
|
|
5
|
+
export declare const INPUT_COMPONENT = "InputComponent";
|
|
6
|
+
export type RigidBodyComponent = {
|
|
7
|
+
center: Point;
|
|
8
|
+
orientationAngle: number;
|
|
9
|
+
AABB: {
|
|
10
|
+
min: Point;
|
|
11
|
+
max: Point;
|
|
12
|
+
};
|
|
13
|
+
mass: number;
|
|
14
|
+
staticFrictionCoeff: number;
|
|
15
|
+
dynamicFrictionCoeff: number;
|
|
16
|
+
momentOfInertia: number;
|
|
17
|
+
isStatic: boolean;
|
|
18
|
+
isMovingStatic: boolean;
|
|
19
|
+
} & ({
|
|
20
|
+
shapeType: "circle";
|
|
21
|
+
radius: number;
|
|
22
|
+
} | {
|
|
23
|
+
shapeType: "polygon";
|
|
24
|
+
vertices: Point[];
|
|
25
|
+
});
|
|
26
|
+
export type PhysicsComponent = {
|
|
27
|
+
force: Point;
|
|
28
|
+
angularDampingFactor: number;
|
|
29
|
+
linearAcceleration: Point;
|
|
30
|
+
angularAcceleration: number;
|
|
31
|
+
linearVelocity: Point;
|
|
32
|
+
angularVelocity: number;
|
|
33
|
+
};
|
|
34
|
+
export type RenderComponent = {
|
|
35
|
+
show: boolean;
|
|
36
|
+
};
|
|
37
|
+
export type Direction = "idle" | "up" | "down" | "left" | "right";
|
|
38
|
+
export type InputComponent = {
|
|
39
|
+
direction: Direction;
|
|
40
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Coordinator, Entity, System } from "@ue-too/ecs";
|
|
2
|
+
export declare class PhysicsSystem implements System {
|
|
3
|
+
entities: Set<Entity>;
|
|
4
|
+
private coordinator;
|
|
5
|
+
private _frictionEnabled;
|
|
6
|
+
constructor(coordinator: Coordinator);
|
|
7
|
+
get frictionEnabled(): boolean;
|
|
8
|
+
update(deltaTime: number): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Coordinator, Entity, System } from "@ue-too/ecs";
|
|
2
|
+
export declare class Canvas2DContextRenderSystem implements System {
|
|
3
|
+
entities: Set<Entity>;
|
|
4
|
+
private coordinator;
|
|
5
|
+
private context;
|
|
6
|
+
constructor(coordinator: Coordinator, context: CanvasRenderingContext2D);
|
|
7
|
+
update(deltaTime: number): void;
|
|
8
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export * from "./rigidbody";
|
|
2
2
|
export * from "./quadtree";
|
|
3
|
+
export * from "./dynamic-tree";
|
|
3
4
|
export * from "./collision";
|
|
5
|
+
export * from "./world";
|
|
6
|
+
export * from "./constraint";
|
|
7
|
+
export * from "./ecs-version";
|
|
8
|
+
export * from "./simple-benchmark-runner";
|
|
9
|
+
export * from "./benchmark";
|
|
10
|
+
export * from "./collision-filter";
|
|
11
|
+
export * from "./pair-manager";
|