angular-three-cannon 4.0.0-next.11 → 4.0.0-next.111
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/body/index.d.ts +114 -2
- package/constraint/README.md +11 -11
- package/constraint/index.d.ts +61 -1
- package/debug/README.md +4 -5
- package/debug/index.d.ts +28 -1
- package/fesm2022/angular-three-cannon-body.mjs +61 -16
- package/fesm2022/angular-three-cannon-body.mjs.map +1 -1
- package/fesm2022/angular-three-cannon-constraint.mjs +38 -13
- package/fesm2022/angular-three-cannon-constraint.mjs.map +1 -1
- package/fesm2022/angular-three-cannon-debug.mjs +6 -6
- package/fesm2022/angular-three-cannon-debug.mjs.map +1 -1
- package/fesm2022/angular-three-cannon.mjs +13 -8
- package/fesm2022/angular-three-cannon.mjs.map +1 -1
- package/index.d.ts +63 -1
- package/package.json +8 -8
- package/body/lib/body.d.ts +0 -17
- package/body/lib/types.d.ts +0 -49
- package/body/lib/utils.d.ts +0 -50
- package/constraint/lib/constraint.d.ts +0 -32
- package/debug/lib/debug.d.ts +0 -24
- package/lib/physics.d.ts +0 -60
package/body/lib/types.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { AtomicName, AtomicProps, BodyProps, BoxProps, CompoundBodyProps, ConvexPolyhedronProps, CylinderProps, HeightfieldProps, ParticleProps, PlaneProps, Quad, SphereProps, TrimeshProps, Triplet, VectorName } from '@pmndrs/cannon-worker-api';
|
|
2
|
-
import type * as THREE from 'three';
|
|
3
|
-
export interface NgtcAtomicApi<K extends AtomicName> {
|
|
4
|
-
set: (value: AtomicProps[K]) => void;
|
|
5
|
-
subscribe: (callback: (value: AtomicProps[K]) => void) => () => void;
|
|
6
|
-
}
|
|
7
|
-
export interface NgtcQuaternionApi {
|
|
8
|
-
copy: ({ w, x, y, z }: THREE.Quaternion) => void;
|
|
9
|
-
set: (x: number, y: number, z: number, w: number) => void;
|
|
10
|
-
subscribe: (callback: (value: Quad) => void) => () => void;
|
|
11
|
-
}
|
|
12
|
-
export interface NgtcVectorApi {
|
|
13
|
-
copy: ({ x, y, z }: THREE.Vector3 | THREE.Euler) => void;
|
|
14
|
-
set: (x: number, y: number, z: number) => void;
|
|
15
|
-
subscribe: (callback: (value: Triplet) => void) => () => void;
|
|
16
|
-
}
|
|
17
|
-
export type NgtcWorkerApi = {
|
|
18
|
-
[K in AtomicName]: NgtcAtomicApi<K>;
|
|
19
|
-
} & {
|
|
20
|
-
[K in VectorName]: NgtcVectorApi;
|
|
21
|
-
} & {
|
|
22
|
-
applyForce: (force: Triplet, worldPoint: Triplet) => void;
|
|
23
|
-
applyImpulse: (impulse: Triplet, worldPoint: Triplet) => void;
|
|
24
|
-
applyLocalForce: (force: Triplet, localPoint: Triplet) => void;
|
|
25
|
-
applyLocalImpulse: (impulse: Triplet, localPoint: Triplet) => void;
|
|
26
|
-
applyTorque: (torque: Triplet) => void;
|
|
27
|
-
quaternion: NgtcQuaternionApi;
|
|
28
|
-
rotation: NgtcVectorApi;
|
|
29
|
-
scaleOverride: (scale: Triplet) => void;
|
|
30
|
-
sleep: () => void;
|
|
31
|
-
wakeUp: () => void;
|
|
32
|
-
remove: () => void;
|
|
33
|
-
};
|
|
34
|
-
export interface NgtcBodyPublicApi extends NgtcWorkerApi {
|
|
35
|
-
at: (index: number) => NgtcWorkerApi;
|
|
36
|
-
}
|
|
37
|
-
export interface NgtcBodyPropsMap {
|
|
38
|
-
Plane: PlaneProps;
|
|
39
|
-
Box: BoxProps;
|
|
40
|
-
Particle: ParticleProps;
|
|
41
|
-
Cylinder: CylinderProps;
|
|
42
|
-
Sphere: SphereProps;
|
|
43
|
-
Trimesh: TrimeshProps;
|
|
44
|
-
Heightfield: HeightfieldProps;
|
|
45
|
-
ConvexPolyhedron: ConvexPolyhedronProps;
|
|
46
|
-
Compound: CompoundBodyProps;
|
|
47
|
-
}
|
|
48
|
-
export type NgtcGetByIndex<T extends BodyProps> = (index: number) => T;
|
|
49
|
-
export type NgtcArgFn<T extends BodyProps> = (args: NonNullable<T['args']>) => typeof args;
|
package/body/lib/utils.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { BodyProps, BoxProps, CannonWorkerAPI, CompoundBodyProps, ConvexPolyhedronArgs, CylinderArgs, HeightfieldArgs, ParticleProps, PlaneProps, PropValue, SphereArgs, SubscriptionName, SubscriptionTarget, Subscriptions, TrimeshArgs, Triplet } from '@pmndrs/cannon-worker-api';
|
|
2
|
-
import { NgtcCannonEvents, NgtcPhysics } from 'angular-three-cannon';
|
|
3
|
-
import * as THREE from 'three';
|
|
4
|
-
import { NgtcWorkerApi } from './types';
|
|
5
|
-
export declare function createSubscribe<T extends SubscriptionName>(body: THREE.Object3D, worker: CannonWorkerAPI, subscriptions: Subscriptions, type: T, index?: number, target?: SubscriptionTarget): (callback: (value: PropValue<T>) => void) => () => void;
|
|
6
|
-
export declare function prepare(object: THREE.Object3D, { position, rotation, userData }: BodyProps): void;
|
|
7
|
-
export declare function setupCollision(events: NgtcCannonEvents, { onCollide, onCollideBegin, onCollideEnd }: Partial<BodyProps>, uuid: string): void;
|
|
8
|
-
export declare function makeBodyApi(body: THREE.Object3D, worker: CannonWorkerAPI, { subscriptions, scaleOverrides }: Pick<NgtcPhysics, 'subscriptions' | 'scaleOverrides'>): {
|
|
9
|
-
at: (index: number) => NgtcWorkerApi;
|
|
10
|
-
allowSleep: import("angular-three-cannon/body").NgtcAtomicApi<"allowSleep">;
|
|
11
|
-
angularDamping: import("angular-three-cannon/body").NgtcAtomicApi<"angularDamping">;
|
|
12
|
-
collisionFilterGroup: import("angular-three-cannon/body").NgtcAtomicApi<"collisionFilterGroup">;
|
|
13
|
-
collisionFilterMask: import("angular-three-cannon/body").NgtcAtomicApi<"collisionFilterMask">;
|
|
14
|
-
collisionResponse: import("angular-three-cannon/body").NgtcAtomicApi<"collisionResponse">;
|
|
15
|
-
fixedRotation: import("angular-three-cannon/body").NgtcAtomicApi<"fixedRotation">;
|
|
16
|
-
isTrigger: import("angular-three-cannon/body").NgtcAtomicApi<"isTrigger">;
|
|
17
|
-
linearDamping: import("angular-three-cannon/body").NgtcAtomicApi<"linearDamping">;
|
|
18
|
-
mass: import("angular-three-cannon/body").NgtcAtomicApi<"mass">;
|
|
19
|
-
material: import("angular-three-cannon/body").NgtcAtomicApi<"material">;
|
|
20
|
-
sleepSpeedLimit: import("angular-three-cannon/body").NgtcAtomicApi<"sleepSpeedLimit">;
|
|
21
|
-
sleepTimeLimit: import("angular-three-cannon/body").NgtcAtomicApi<"sleepTimeLimit">;
|
|
22
|
-
userData: import("angular-three-cannon/body").NgtcAtomicApi<"userData">;
|
|
23
|
-
angularFactor: import("angular-three-cannon/body").NgtcVectorApi;
|
|
24
|
-
angularVelocity: import("angular-three-cannon/body").NgtcVectorApi;
|
|
25
|
-
linearFactor: import("angular-three-cannon/body").NgtcVectorApi;
|
|
26
|
-
position: import("angular-three-cannon/body").NgtcVectorApi;
|
|
27
|
-
velocity: import("angular-three-cannon/body").NgtcVectorApi;
|
|
28
|
-
applyForce: (force: Triplet, worldPoint: Triplet) => void;
|
|
29
|
-
applyImpulse: (impulse: Triplet, worldPoint: Triplet) => void;
|
|
30
|
-
applyLocalForce: (force: Triplet, localPoint: Triplet) => void;
|
|
31
|
-
applyLocalImpulse: (impulse: Triplet, localPoint: Triplet) => void;
|
|
32
|
-
applyTorque: (torque: Triplet) => void;
|
|
33
|
-
quaternion: import("angular-three-cannon/body").NgtcQuaternionApi;
|
|
34
|
-
rotation: import("angular-three-cannon/body").NgtcVectorApi;
|
|
35
|
-
scaleOverride: (scale: Triplet) => void;
|
|
36
|
-
sleep: () => void;
|
|
37
|
-
wakeUp: () => void;
|
|
38
|
-
remove: () => void;
|
|
39
|
-
};
|
|
40
|
-
export declare const defaultTransformArgs: {
|
|
41
|
-
Plane: (_: PlaneProps["args"]) => never[];
|
|
42
|
-
Box: (args?: BoxProps["args"]) => Triplet;
|
|
43
|
-
Trimesh: (args: TrimeshArgs) => TrimeshArgs;
|
|
44
|
-
Cylinder: (_?: CylinderArgs) => never[];
|
|
45
|
-
Heightfield: (args: HeightfieldArgs) => HeightfieldArgs;
|
|
46
|
-
ConvexPolyhedron: ([vertices, faces, normals, axes, boundingSphereRadius]?: ConvexPolyhedronArgs) => (number | number[][] | undefined)[];
|
|
47
|
-
Particle: (_: ParticleProps["args"]) => never[];
|
|
48
|
-
Sphere: (args?: SphereArgs) => number[];
|
|
49
|
-
Compound: (args: CompoundBodyProps["args"]) => unknown[] | undefined;
|
|
50
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ElementRef, Injector, Signal } from '@angular/core';
|
|
2
|
-
import { ConeTwistConstraintOpts, ConstraintTypes, DistanceConstraintOpts, HingeConstraintOpts, LockConstraintOpts, PointToPointConstraintOpts } from '@pmndrs/cannon-worker-api';
|
|
3
|
-
import * as THREE from 'three';
|
|
4
|
-
export interface NgtcConstraintApi {
|
|
5
|
-
disable: () => void;
|
|
6
|
-
enable: () => void;
|
|
7
|
-
remove: () => void;
|
|
8
|
-
}
|
|
9
|
-
export interface NgtcHingeConstraintApi extends NgtcConstraintApi {
|
|
10
|
-
disableMotor: () => void;
|
|
11
|
-
enableMotor: () => void;
|
|
12
|
-
setMotorMaxForce: (value: number) => void;
|
|
13
|
-
setMotorSpeed: (value: number) => void;
|
|
14
|
-
}
|
|
15
|
-
export type NgtcConstraintORHingeApi<T extends 'Hinge' | ConstraintTypes> = T extends ConstraintTypes ? NgtcConstraintApi : NgtcHingeConstraintApi;
|
|
16
|
-
export type NgtcConstraintOptionsMap = {
|
|
17
|
-
ConeTwist: ConeTwistConstraintOpts;
|
|
18
|
-
PointToPoint: PointToPointConstraintOpts;
|
|
19
|
-
Distance: DistanceConstraintOpts;
|
|
20
|
-
Lock: LockConstraintOpts;
|
|
21
|
-
Hinge: HingeConstraintOpts;
|
|
22
|
-
};
|
|
23
|
-
export type NgtcConstraintOptions<TConstraintType extends 'Hinge' | ConstraintTypes> = {
|
|
24
|
-
injector?: Injector;
|
|
25
|
-
disableOnStart?: boolean;
|
|
26
|
-
options?: NgtcConstraintOptionsMap[TConstraintType];
|
|
27
|
-
};
|
|
28
|
-
export declare const injectPointToPoint: <A extends THREE.Object3D = THREE.Object3D<THREE.Object3DEventMap>, B extends THREE.Object3D = THREE.Object3D<THREE.Object3DEventMap>>(bodyA: A | ElementRef<A> | Signal<A | ElementRef<A> | undefined>, bodyB: B | ElementRef<B> | Signal<B | ElementRef<B> | undefined>, options?: NgtcConstraintOptions<"PointToPoint"> | undefined) => Signal<NgtcConstraintApi | null>;
|
|
29
|
-
export declare const injectConeTwist: <A extends THREE.Object3D = THREE.Object3D<THREE.Object3DEventMap>, B extends THREE.Object3D = THREE.Object3D<THREE.Object3DEventMap>>(bodyA: A | ElementRef<A> | Signal<A | ElementRef<A> | undefined>, bodyB: B | ElementRef<B> | Signal<B | ElementRef<B> | undefined>, options?: NgtcConstraintOptions<"ConeTwist"> | undefined) => Signal<NgtcConstraintApi | null>;
|
|
30
|
-
export declare const injectDistance: <A extends THREE.Object3D = THREE.Object3D<THREE.Object3DEventMap>, B extends THREE.Object3D = THREE.Object3D<THREE.Object3DEventMap>>(bodyA: A | ElementRef<A> | Signal<A | ElementRef<A> | undefined>, bodyB: B | ElementRef<B> | Signal<B | ElementRef<B> | undefined>, options?: NgtcConstraintOptions<"Distance"> | undefined) => Signal<NgtcConstraintApi | null>;
|
|
31
|
-
export declare const injectLock: <A extends THREE.Object3D = THREE.Object3D<THREE.Object3DEventMap>, B extends THREE.Object3D = THREE.Object3D<THREE.Object3DEventMap>>(bodyA: A | ElementRef<A> | Signal<A | ElementRef<A> | undefined>, bodyB: B | ElementRef<B> | Signal<B | ElementRef<B> | undefined>, options?: NgtcConstraintOptions<"Lock"> | undefined) => Signal<NgtcConstraintApi | null>;
|
|
32
|
-
export declare const injectHinge: <A extends THREE.Object3D = THREE.Object3D<THREE.Object3DEventMap>, B extends THREE.Object3D = THREE.Object3D<THREE.Object3DEventMap>>(bodyA: A | ElementRef<A> | Signal<A | ElementRef<A> | undefined>, bodyB: B | ElementRef<B> | Signal<B | ElementRef<B> | undefined>, options?: NgtcConstraintOptions<"Hinge"> | undefined) => Signal<NgtcConstraintApi | null>;
|
package/debug/lib/debug.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BodyProps, BodyShapeType } from '@pmndrs/cannon-worker-api';
|
|
2
|
-
import CannonDebugger from 'cannon-es-debugger';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export interface NgtcDebugInputs {
|
|
5
|
-
enabled: boolean;
|
|
6
|
-
color: string;
|
|
7
|
-
impl: typeof CannonDebugger;
|
|
8
|
-
scale: number;
|
|
9
|
-
}
|
|
10
|
-
export declare class NgtcDebug {
|
|
11
|
-
debug: import("@angular/core").InputSignalWithTransform<NgtcDebugInputs, "" | Partial<NgtcDebugInputs>>;
|
|
12
|
-
private physics;
|
|
13
|
-
private store;
|
|
14
|
-
private defaultScene;
|
|
15
|
-
private debuggerScene;
|
|
16
|
-
private bodies;
|
|
17
|
-
private bodyMap;
|
|
18
|
-
private cannonDebugger;
|
|
19
|
-
constructor();
|
|
20
|
-
add(uuid: string, props: BodyProps, type: BodyShapeType): void;
|
|
21
|
-
remove(uuid: string): void;
|
|
22
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgtcDebug, never>;
|
|
23
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgtcDebug, "ngtc-physics[debug]", never, { "debug": { "alias": "debug"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
24
|
-
}
|
package/lib/physics.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { CannonWorkerAPI, CannonWorkerProps, CollideBeginEvent, CollideEndEvent, CollideEvent, RayhitEvent, Refs, Subscriptions, WorkerCollideBeginEvent, WorkerCollideEndEvent, WorkerCollideEvent, WorkerFrameMessage, WorkerRayhitEvent } from '@pmndrs/cannon-worker-api';
|
|
2
|
-
import * as THREE from 'three';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export interface NgtcCannonWorkerEvents {
|
|
5
|
-
collide: WorkerCollideEvent;
|
|
6
|
-
collideBegin: WorkerCollideBeginEvent;
|
|
7
|
-
collideEnd: WorkerCollideEndEvent;
|
|
8
|
-
frame: WorkerFrameMessage;
|
|
9
|
-
rayhit: WorkerRayhitEvent;
|
|
10
|
-
}
|
|
11
|
-
export type NgtcCannonWorker = CannonWorkerAPI & {
|
|
12
|
-
on: <K extends keyof NgtcCannonWorkerEvents>(event: K, cb: (data: NgtcCannonWorkerEvents[K]['data']) => void) => void;
|
|
13
|
-
removeAllListeners: () => void;
|
|
14
|
-
};
|
|
15
|
-
type NgtcCannonEvent = CollideBeginEvent | CollideEndEvent | CollideEvent | RayhitEvent;
|
|
16
|
-
type NgtcCallbackByType<T extends {
|
|
17
|
-
type: string;
|
|
18
|
-
}> = {
|
|
19
|
-
[K in T['type']]?: T extends {
|
|
20
|
-
type: K;
|
|
21
|
-
} ? (e: T) => void : never;
|
|
22
|
-
};
|
|
23
|
-
export type NgtcCannonEvents = Record<string, Partial<NgtcCallbackByType<NgtcCannonEvent>>>;
|
|
24
|
-
export type ScaleOverrides = Record<string, THREE.Vector3>;
|
|
25
|
-
export interface NgtcPhysicsOptions extends CannonWorkerProps {
|
|
26
|
-
isPaused?: boolean;
|
|
27
|
-
maxSubSteps?: number;
|
|
28
|
-
shouldInvalidate?: boolean;
|
|
29
|
-
stepSize?: number;
|
|
30
|
-
}
|
|
31
|
-
export declare class NgtcPhysics {
|
|
32
|
-
private store;
|
|
33
|
-
options: import("@angular/core").InputSignalWithTransform<NgtcPhysicsOptions, "" | Partial<NgtcPhysicsOptions>>;
|
|
34
|
-
private axisIndex;
|
|
35
|
-
private broadphase;
|
|
36
|
-
private gravity;
|
|
37
|
-
private iterations;
|
|
38
|
-
private tolerance;
|
|
39
|
-
private invalidate;
|
|
40
|
-
private cannonWorker;
|
|
41
|
-
bodies: {
|
|
42
|
-
[uuid: string]: number;
|
|
43
|
-
};
|
|
44
|
-
events: NgtcCannonEvents;
|
|
45
|
-
refs: Refs;
|
|
46
|
-
scaleOverrides: ScaleOverrides;
|
|
47
|
-
subscriptions: Subscriptions;
|
|
48
|
-
worker: import("@angular/core").Signal<CannonWorkerAPI>;
|
|
49
|
-
constructor();
|
|
50
|
-
private connectWorkerEffect;
|
|
51
|
-
private updateWorkerStateEffect;
|
|
52
|
-
private collideHandler;
|
|
53
|
-
private collideBeginHandler;
|
|
54
|
-
private collideEndHandler;
|
|
55
|
-
private frameHandler;
|
|
56
|
-
private rayhitHandler;
|
|
57
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgtcPhysics, never>;
|
|
58
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgtcPhysics, "ngtc-physics", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
59
|
-
}
|
|
60
|
-
export {};
|