exodeui 6.3.21 → 6.3.22
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/dist/index.js +33 -31
- package/dist/index.mjs +1700 -1632
- package/dist/src/index.d.ts +1 -0
- package/dist/src/physics/PhysicsEngine.d.ts +25 -0
- package/dist/src/physics/RapierPhysics.d.ts +15 -1
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -14,14 +14,37 @@ export interface BodyOptions {
|
|
|
14
14
|
density?: number;
|
|
15
15
|
isSensor?: boolean;
|
|
16
16
|
}
|
|
17
|
+
export interface JointOptions {
|
|
18
|
+
id: string;
|
|
19
|
+
type: 'Distance' | 'Revolute';
|
|
20
|
+
bodyA: string;
|
|
21
|
+
bodyB: string;
|
|
22
|
+
anchorA: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
};
|
|
26
|
+
anchorB: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
length?: number;
|
|
31
|
+
stiffness?: number;
|
|
32
|
+
damping?: number;
|
|
33
|
+
}
|
|
17
34
|
export interface PhysicsEngine {
|
|
18
35
|
init(gravity: {
|
|
19
36
|
x: number;
|
|
20
37
|
y: number;
|
|
21
38
|
}): Promise<void>;
|
|
22
39
|
destroy(): void;
|
|
40
|
+
setGravity(gravity: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
}): void;
|
|
23
44
|
createBody(options: BodyOptions): void;
|
|
24
45
|
removeBody(id: string): void;
|
|
46
|
+
createJoint(options: JointOptions): void;
|
|
47
|
+
removeJoint(id: string): void;
|
|
25
48
|
step(dt: number): void;
|
|
26
49
|
getPosition(id: string): {
|
|
27
50
|
x: number;
|
|
@@ -35,6 +58,8 @@ export interface PhysicsEngine {
|
|
|
35
58
|
setPosition(id: string, x: number, y: number): void;
|
|
36
59
|
setRotation(id: string, angle: number): void;
|
|
37
60
|
setVelocity(id: string, vx: number, vy: number): void;
|
|
61
|
+
setAngularVelocity(id: string, omega: number): void;
|
|
38
62
|
applyForce(id: string, fx: number, fy: number): void;
|
|
39
63
|
applyImpulse(id: string, ix: number, iy: number): void;
|
|
64
|
+
setCollisionCallback?(cb: (a: string, b: string, started: boolean) => void): void;
|
|
40
65
|
}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import { PhysicsEngine, BodyOptions } from './PhysicsEngine';
|
|
1
|
+
import { PhysicsEngine, BodyOptions, JointOptions } from './PhysicsEngine';
|
|
2
2
|
|
|
3
|
+
type CollisionCallback = (a: string, b: string, started: boolean) => void;
|
|
3
4
|
export declare class RapierPhysics implements PhysicsEngine {
|
|
4
5
|
private world;
|
|
5
6
|
private bodies;
|
|
6
7
|
private colliders;
|
|
8
|
+
private joints;
|
|
7
9
|
private initialized;
|
|
10
|
+
private bodyIdByCollider;
|
|
11
|
+
private onCollisionCB;
|
|
12
|
+
private eventQueue;
|
|
13
|
+
setCollisionCallback(cb: CollisionCallback): void;
|
|
8
14
|
init(gravity: {
|
|
9
15
|
x: number;
|
|
10
16
|
y: number;
|
|
11
17
|
}): Promise<void>;
|
|
12
18
|
destroy(): void;
|
|
19
|
+
setGravity(gravity: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}): void;
|
|
13
23
|
createBody(options: BodyOptions): void;
|
|
14
24
|
removeBody(id: string): void;
|
|
15
25
|
step(_dt: number): void;
|
|
@@ -25,6 +35,10 @@ export declare class RapierPhysics implements PhysicsEngine {
|
|
|
25
35
|
setPosition(id: string, x: number, y: number): void;
|
|
26
36
|
setRotation(id: string, angle: number): void;
|
|
27
37
|
setVelocity(id: string, vx: number, vy: number): void;
|
|
38
|
+
setAngularVelocity(id: string, omega: number): void;
|
|
28
39
|
applyForce(id: string, fx: number, fy: number): void;
|
|
29
40
|
applyImpulse(id: string, ix: number, iy: number): void;
|
|
41
|
+
createJoint(options: JointOptions): void;
|
|
42
|
+
removeJoint(id: string): void;
|
|
30
43
|
}
|
|
44
|
+
export {};
|