angular-three-cannon 4.0.0-next.2 → 4.0.0-next.20

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/debug/README.md CHANGED
@@ -31,10 +31,10 @@ The `NgtcDebug` directive is applied to the `ngtc-physics` component to enable p
31
31
 
32
32
  - `debug`: An object containing the following properties:
33
33
 
34
- - `enabled`: (boolean) Whether the debug visualization is enabled (default: true).
35
- - `color`: (string) The color of the debug visualization (default: 'black').
36
- - `impl`: (typeof CannonDebugger) The implementation of the CannonDebugger to use (default: CannonDebugger).
37
- - `scale`: (number) The scale of the debug visualization (default: 1).
34
+ - `enabled`: (boolean) Whether the debug visualization is enabled (default: true).
35
+ - `color`: (string) The color of the debug visualization (default: 'black').
36
+ - `impl`: (typeof CannonDebugger) The implementation of the CannonDebugger to use (default: CannonDebugger).
37
+ - `scale`: (number) The scale of the debug visualization (default: 1).
38
38
 
39
39
  ## Usage
40
40
 
@@ -72,10 +72,10 @@ class NgtcDebug {
72
72
  this.bodies.splice(debugBodyIndex, 1);
73
73
  delete this.bodyMap[uuid];
74
74
  }
75
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtcDebug, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
76
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.6", type: NgtcDebug, isStandalone: true, selector: "ngtc-physics[debug]", inputs: { debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
75
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NgtcDebug, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
76
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.5", type: NgtcDebug, isStandalone: true, selector: "ngtc-physics[debug]", inputs: { debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
77
77
  }
78
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtcDebug, decorators: [{
78
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NgtcDebug, decorators: [{
79
79
  type: Directive,
80
80
  args: [{ selector: 'ngtc-physics[debug]' }]
81
81
  }], ctorParameters: () => [] });
@@ -115,7 +115,12 @@ class NgtcPhysics {
115
115
  const { events, refs } = this;
116
116
  const cb = events[target]?.collide;
117
117
  if (cb) {
118
- cb({ body: refs[body], contact: { bi: refs[bi], bj: refs[bj], ...contactRest }, target: refs[target], ...rest });
118
+ cb({
119
+ body: refs[body],
120
+ contact: { bi: refs[bi], bj: refs[bj], ...contactRest },
121
+ target: refs[target],
122
+ ...rest,
123
+ });
119
124
  }
120
125
  }
121
126
  collideBeginHandler({ bodyA, bodyB }) {
@@ -178,10 +183,10 @@ class NgtcPhysics {
178
183
  if (cb)
179
184
  cb({ body: body ? refs[body] : null, ray: { uuid, ...rayRest }, ...rest });
180
185
  }
181
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtcPhysics, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
182
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.6", type: NgtcPhysics, isStandalone: true, selector: "ngtc-physics", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
186
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NgtcPhysics, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
187
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.5", type: NgtcPhysics, isStandalone: true, selector: "ngtc-physics", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
183
188
  }
184
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtcPhysics, decorators: [{
189
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NgtcPhysics, decorators: [{
185
190
  type: Directive,
186
191
  args: [{ selector: 'ngtc-physics' }]
187
192
  }], ctorParameters: () => [] });
@@ -1 +1 @@
1
- {"version":3,"file":"angular-three-cannon.mjs","sources":["../../../../libs/cannon/src/lib/physics.ts","../../../../libs/cannon/src/angular-three-cannon.ts"],"sourcesContent":["import { Directive, Injector, afterNextRender, effect, inject, input, signal, untracked } from '@angular/core';\nimport {\n\tCannonWorkerAPI,\n\tCannonWorkerProps,\n\tCollideBeginEvent,\n\tCollideEndEvent,\n\tCollideEvent,\n\tRayhitEvent,\n\tRefs,\n\tSubscriptions,\n\tWorkerCollideBeginEvent,\n\tWorkerCollideEndEvent,\n\tWorkerCollideEvent,\n\tWorkerFrameMessage,\n\tWorkerRayhitEvent,\n} from '@pmndrs/cannon-worker-api';\nimport { injectBeforeRender, injectStore, is, pick } from 'angular-three';\nimport { mergeInputs } from 'ngxtension/inject-inputs';\nimport * as THREE from 'three';\n\nexport interface NgtcCannonWorkerEvents {\n\tcollide: WorkerCollideEvent;\n\tcollideBegin: WorkerCollideBeginEvent;\n\tcollideEnd: WorkerCollideEndEvent;\n\tframe: WorkerFrameMessage;\n\trayhit: WorkerRayhitEvent;\n}\n\nexport type NgtcCannonWorker = CannonWorkerAPI & {\n\ton: <K extends keyof NgtcCannonWorkerEvents>(event: K, cb: (data: NgtcCannonWorkerEvents[K]['data']) => void) => void;\n\tremoveAllListeners: () => void;\n};\n\nconst v = new THREE.Vector3();\nconst s = new THREE.Vector3(1, 1, 1);\nconst q = new THREE.Quaternion();\nconst m = new THREE.Matrix4();\n\nfunction apply(\n\tindex: number,\n\tpositions: ArrayLike<number>,\n\tquaternions: ArrayLike<number>,\n\tscale = s,\n\tobject?: THREE.Object3D,\n) {\n\tif (index !== undefined) {\n\t\tm.compose(v.fromArray(positions, index * 3), q.fromArray(quaternions as THREE.QuaternionTuple, index * 4), scale);\n\t\tif (object) {\n\t\t\tobject.matrixAutoUpdate = false;\n\t\t\tobject.matrix.copy(m);\n\t\t}\n\t\treturn m;\n\t}\n\treturn m.identity();\n}\n\nfunction unique() {\n\tconst values: unknown[] = [];\n\treturn (value: unknown) => (values.includes(value) ? false : !!values.push(value));\n}\n\ntype NgtcCannonEvent = CollideBeginEvent | CollideEndEvent | CollideEvent | RayhitEvent;\ntype NgtcCallbackByType<T extends { type: string }> = {\n\t[K in T['type']]?: T extends { type: K } ? (e: T) => void : never;\n};\n\nexport type NgtcCannonEvents = Record<string, Partial<NgtcCallbackByType<NgtcCannonEvent>>>;\n\nexport type ScaleOverrides = Record<string, THREE.Vector3>;\n\nexport interface NgtcPhysicsOptions extends CannonWorkerProps {\n\tisPaused?: boolean;\n\tmaxSubSteps?: number;\n\tshouldInvalidate?: boolean;\n\tstepSize?: number;\n}\n\nconst defaultOptions: NgtcPhysicsOptions = {\n\tallowSleep: false,\n\taxisIndex: 0,\n\tbroadphase: 'Naive',\n\tdefaultContactMaterial: { contactEquationStiffness: 1e6 },\n\tfrictionGravity: null,\n\tgravity: [0, -9.81, 0],\n\tisPaused: false,\n\titerations: 5,\n\tmaxSubSteps: 10,\n\tquatNormalizeFast: false,\n\tquatNormalizeSkip: 0,\n\tshouldInvalidate: true,\n\tsize: 1000,\n\tsolver: 'GS',\n\tstepSize: 1 / 60,\n\ttolerance: 0.001,\n};\n\ntype NgtsPhysicsUpdatableOptions = Extract<\n\tkeyof NgtcPhysicsOptions,\n\t'gravity' | 'iterations' | 'tolerance' | 'broadphase' | 'axisIndex'\n>;\n\n@Directive({ selector: 'ngtc-physics' })\nexport class NgtcPhysics {\n\tprivate store = injectStore();\n\n\toptions = input(defaultOptions, { transform: mergeInputs(defaultOptions) });\n\n\tprivate axisIndex = pick(this.options, 'axisIndex');\n\tprivate broadphase = pick(this.options, 'broadphase');\n\tprivate gravity = pick(this.options, 'gravity');\n\tprivate iterations = pick(this.options, 'iterations');\n\tprivate tolerance = pick(this.options, 'tolerance');\n\n\tprivate invalidate = this.store.invalidate;\n\t// @ts-expect-error - worker is not nullable, and we don't want to use ! operator.\n\tprivate cannonWorker = signal<CannonWorkerAPI>(null);\n\n\tbodies: { [uuid: string]: number } = {};\n\tevents: NgtcCannonEvents = {};\n\trefs: Refs = {};\n\tscaleOverrides: ScaleOverrides = {};\n\tsubscriptions: Subscriptions = {};\n\tworker = this.cannonWorker.asReadonly();\n\n\tconstructor() {\n\t\tconst injector = inject(Injector);\n\n\t\t// NOTE: set new cannonworker in afterNextRender\n\t\t// - so inputs are resolved\n\t\t// - so the worker is instantiated only once\n\t\t// - effects are started after worker is instantiated\n\t\tafterNextRender(() => {\n\t\t\tthis.cannonWorker.set(new CannonWorkerAPI(this.options()));\n\n\t\t\teffect(\n\t\t\t\t(onCleanup) => {\n\t\t\t\t\tconst cleanup = this.connectWorkerEffect();\n\t\t\t\t\tonCleanup(() => cleanup?.());\n\t\t\t\t},\n\t\t\t\t{ injector },\n\t\t\t);\n\n\t\t\teffect(\n\t\t\t\t() => {\n\t\t\t\t\tthis.updateWorkerStateEffect('axisIndex', this.axisIndex);\n\t\t\t\t\tthis.updateWorkerStateEffect('broadphase', this.broadphase);\n\t\t\t\t\tthis.updateWorkerStateEffect('gravity', this.gravity);\n\t\t\t\t\tthis.updateWorkerStateEffect('iterations', this.iterations);\n\t\t\t\t\tthis.updateWorkerStateEffect('tolerance', this.tolerance);\n\t\t\t\t},\n\t\t\t\t{ injector },\n\t\t\t);\n\t\t});\n\n\t\tlet timeSinceLastCalled = 0;\n\t\tinjectBeforeRender(({ delta }) => {\n\t\t\tconst [{ isPaused, maxSubSteps, stepSize }, worker] = [this.options(), this.cannonWorker()];\n\t\t\tif (isPaused || !worker || stepSize == null) return;\n\t\t\ttimeSinceLastCalled += delta;\n\t\t\tworker.step({ maxSubSteps, stepSize, timeSinceLastCalled });\n\t\t\ttimeSinceLastCalled = 0;\n\t\t});\n\t}\n\n\tprivate connectWorkerEffect() {\n\t\tconst worker = this.cannonWorker() as NgtcCannonWorker;\n\t\tif (!worker) return;\n\n\t\tworker.connect();\n\t\tworker.init();\n\n\t\tworker.on('collide', this.collideHandler.bind(this));\n\t\tworker.on('collideBegin', this.collideBeginHandler.bind(this));\n\t\tworker.on('collideEnd', this.collideEndHandler.bind(this));\n\t\tworker.on('frame', this.frameHandler.bind(this));\n\t\tworker.on('rayhit', this.rayhitHandler.bind(this));\n\n\t\treturn () => {\n\t\t\tworker.terminate();\n\t\t\tworker.removeAllListeners();\n\t\t};\n\t}\n\n\tprivate updateWorkerStateEffect<TUpdatableKey extends NgtsPhysicsUpdatableOptions>(\n\t\tkey: TUpdatableKey,\n\t\toption: () => NgtcPhysicsOptions[TUpdatableKey],\n\t) {\n\t\tconst worker = this.cannonWorker();\n\t\tif (!worker) return;\n\t\tObject.assign(worker, { [key]: option() });\n\t}\n\n\tprivate collideHandler({ body, contact: { bi, bj, ...contactRest }, target, ...rest }: WorkerCollideEvent['data']) {\n\t\tconst { events, refs } = this;\n\t\tconst cb = events[target]?.collide;\n\t\tif (cb) {\n\t\t\tcb({ body: refs[body], contact: { bi: refs[bi], bj: refs[bj], ...contactRest }, target: refs[target], ...rest });\n\t\t}\n\t}\n\n\tprivate collideBeginHandler({ bodyA, bodyB }: WorkerCollideBeginEvent['data']) {\n\t\tconst { events, refs } = this;\n\t\tconst cbA = events[bodyA]?.collideBegin;\n\t\tif (cbA) cbA({ body: refs[bodyB], op: 'event', target: refs[bodyA], type: 'collideBegin' });\n\t\tconst cbB = events[bodyB]?.collideBegin;\n\t\tif (cbB) cbB({ body: refs[bodyA], op: 'event', target: refs[bodyB], type: 'collideBegin' });\n\t}\n\n\tprivate collideEndHandler({ bodyA, bodyB }: WorkerCollideEndEvent['data']) {\n\t\tconst { events, refs } = this;\n\t\tconst cbA = events[bodyA]?.collideEnd;\n\t\tif (cbA) cbA({ body: refs[bodyB], op: 'event', target: refs[bodyA], type: 'collideEnd' });\n\t\tconst cbB = events[bodyB]?.collideEnd;\n\t\tif (cbB) cbB({ body: refs[bodyA], op: 'event', target: refs[bodyB], type: 'collideEnd' });\n\t}\n\n\tprivate frameHandler({\n\t\tactive,\n\t\tbodies: uuids = [],\n\t\tobservations,\n\t\tpositions,\n\t\tquaternions,\n\t}: WorkerFrameMessage['data']) {\n\t\tconst [{ shouldInvalidate }, { bodies, subscriptions, refs, scaleOverrides }, invalidate] = [\n\t\t\tuntracked(this.options),\n\t\t\tthis,\n\t\t\tthis.invalidate(),\n\t\t];\n\t\tfor (let i = 0; i < uuids.length; i++) {\n\t\t\tbodies[uuids[i]] = i;\n\t\t}\n\t\tobservations.forEach(([id, value, type]) => {\n\t\t\tconst subscription = subscriptions[id] || {};\n\t\t\tconst cb = subscription[type];\n\t\t\t// @ts-expect-error - We clearly know the type of the callback, but typescript can't deal with it\n\t\t\tcb && cb(value);\n\t\t});\n\t\tif (!active) return;\n\t\tfor (const ref of Object.values(refs).filter(unique())) {\n\t\t\tif (is.three<THREE.InstancedMesh>(ref, 'isInstancedMesh')) {\n\t\t\t\tfor (let i = 0; i < ref.count; i++) {\n\t\t\t\t\tconst uuid = `${ref.uuid}/${i}`;\n\t\t\t\t\tconst index = bodies[uuid];\n\t\t\t\t\tif (index !== undefined) {\n\t\t\t\t\t\tref.setMatrixAt(i, apply(index, positions, quaternions, scaleOverrides[uuid]));\n\t\t\t\t\t\tref.instanceMatrix.needsUpdate = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst scale = scaleOverrides[ref.uuid] || ref.scale;\n\t\t\t\tapply(bodies[ref.uuid], positions, quaternions, scale, ref);\n\t\t\t}\n\t\t}\n\t\tif (shouldInvalidate) invalidate();\n\t}\n\n\tprivate rayhitHandler({ body, ray: { uuid, ...rayRest }, ...rest }: WorkerRayhitEvent['data']) {\n\t\tconst { events, refs } = this;\n\t\tconst cb = events[uuid]?.rayhit;\n\t\tif (cb) cb({ body: body ? refs[body] : null, ray: { uuid, ...rayRest }, ...rest });\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAiCA,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE;AAC7B,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACpC,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,UAAU,EAAE;AAChC,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE;AAE7B,SAAS,KAAK,CACb,KAAa,EACb,SAA4B,EAC5B,WAA8B,EAC9B,KAAK,GAAG,CAAC,EACT,MAAuB,EAAA;AAEvB,IAAA,IAAI,KAAK,KAAK,SAAS,EAAE;QACxB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,WAAoC,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC;QACjH,IAAI,MAAM,EAAE;AACX,YAAA,MAAM,CAAC,gBAAgB,GAAG,KAAK;AAC/B,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;;AAEtB,QAAA,OAAO,CAAC;;AAET,IAAA,OAAO,CAAC,CAAC,QAAQ,EAAE;AACpB;AAEA,SAAS,MAAM,GAAA;IACd,MAAM,MAAM,GAAc,EAAE;AAC5B,IAAA,OAAO,CAAC,KAAc,MAAM,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,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EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,CAAC;;;AAG7D,QAAA,IAAI,gBAAgB;AAAE,YAAA,UAAU,EAAE;;AAG3B,IAAA,aAAa,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,GAAG,IAAI,EAA6B,EAAA;AAC5F,QAAA,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI;QAC7B,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM;AAC/B,QAAA,IAAI,EAAE;AAAE,YAAA,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC;;8GA7JvE,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAX,WAAW,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBADvB,SAAS;mBAAC,EAAE,QAAQ,EAAE,cAAc,EAAE;;;ACrGvC;;AAEG;;;;"}
1
+ {"version":3,"file":"angular-three-cannon.mjs","sources":["../../../../libs/cannon/src/lib/physics.ts","../../../../libs/cannon/src/angular-three-cannon.ts"],"sourcesContent":["import { Directive, Injector, afterNextRender, effect, inject, input, signal, untracked } from '@angular/core';\nimport {\n\tCannonWorkerAPI,\n\tCannonWorkerProps,\n\tCollideBeginEvent,\n\tCollideEndEvent,\n\tCollideEvent,\n\tRayhitEvent,\n\tRefs,\n\tSubscriptions,\n\tWorkerCollideBeginEvent,\n\tWorkerCollideEndEvent,\n\tWorkerCollideEvent,\n\tWorkerFrameMessage,\n\tWorkerRayhitEvent,\n} from '@pmndrs/cannon-worker-api';\nimport { injectBeforeRender, injectStore, is, pick } from 'angular-three';\nimport { mergeInputs } from 'ngxtension/inject-inputs';\nimport * as THREE from 'three';\n\nexport interface NgtcCannonWorkerEvents {\n\tcollide: WorkerCollideEvent;\n\tcollideBegin: WorkerCollideBeginEvent;\n\tcollideEnd: WorkerCollideEndEvent;\n\tframe: WorkerFrameMessage;\n\trayhit: WorkerRayhitEvent;\n}\n\nexport type NgtcCannonWorker = CannonWorkerAPI & {\n\ton: <K extends keyof NgtcCannonWorkerEvents>(\n\t\tevent: K,\n\t\tcb: (data: NgtcCannonWorkerEvents[K]['data']) => void,\n\t) => void;\n\tremoveAllListeners: () => void;\n};\n\nconst v = new THREE.Vector3();\nconst s = new THREE.Vector3(1, 1, 1);\nconst q = new THREE.Quaternion();\nconst m = new THREE.Matrix4();\n\nfunction apply(\n\tindex: number,\n\tpositions: ArrayLike<number>,\n\tquaternions: ArrayLike<number>,\n\tscale = s,\n\tobject?: THREE.Object3D,\n) {\n\tif (index !== undefined) {\n\t\tm.compose(\n\t\t\tv.fromArray(positions, index * 3),\n\t\t\tq.fromArray(quaternions as THREE.QuaternionTuple, index * 4),\n\t\t\tscale,\n\t\t);\n\t\tif (object) {\n\t\t\tobject.matrixAutoUpdate = false;\n\t\t\tobject.matrix.copy(m);\n\t\t}\n\t\treturn m;\n\t}\n\treturn m.identity();\n}\n\nfunction unique() {\n\tconst values: unknown[] = [];\n\treturn (value: unknown) => (values.includes(value) ? false : !!values.push(value));\n}\n\ntype NgtcCannonEvent = CollideBeginEvent | CollideEndEvent | CollideEvent | RayhitEvent;\ntype NgtcCallbackByType<T extends { type: string }> = {\n\t[K in T['type']]?: T extends { type: K } ? (e: T) => void : never;\n};\n\nexport type NgtcCannonEvents = Record<string, Partial<NgtcCallbackByType<NgtcCannonEvent>>>;\n\nexport type ScaleOverrides = Record<string, THREE.Vector3>;\n\nexport interface NgtcPhysicsOptions extends CannonWorkerProps {\n\tisPaused?: boolean;\n\tmaxSubSteps?: number;\n\tshouldInvalidate?: boolean;\n\tstepSize?: number;\n}\n\nconst defaultOptions: NgtcPhysicsOptions = {\n\tallowSleep: false,\n\taxisIndex: 0,\n\tbroadphase: 'Naive',\n\tdefaultContactMaterial: { contactEquationStiffness: 1e6 },\n\tfrictionGravity: null,\n\tgravity: [0, -9.81, 0],\n\tisPaused: false,\n\titerations: 5,\n\tmaxSubSteps: 10,\n\tquatNormalizeFast: false,\n\tquatNormalizeSkip: 0,\n\tshouldInvalidate: true,\n\tsize: 1000,\n\tsolver: 'GS',\n\tstepSize: 1 / 60,\n\ttolerance: 0.001,\n};\n\ntype NgtsPhysicsUpdatableOptions = Extract<\n\tkeyof NgtcPhysicsOptions,\n\t'gravity' | 'iterations' | 'tolerance' | 'broadphase' | 'axisIndex'\n>;\n\n@Directive({ selector: 'ngtc-physics' })\nexport class NgtcPhysics {\n\tprivate store = injectStore();\n\n\toptions = input(defaultOptions, { transform: mergeInputs(defaultOptions) });\n\n\tprivate axisIndex = pick(this.options, 'axisIndex');\n\tprivate broadphase = pick(this.options, 'broadphase');\n\tprivate gravity = pick(this.options, 'gravity');\n\tprivate iterations = pick(this.options, 'iterations');\n\tprivate tolerance = pick(this.options, 'tolerance');\n\n\tprivate invalidate = this.store.invalidate;\n\t// @ts-expect-error - worker is not nullable, and we don't want to use ! operator.\n\tprivate cannonWorker = signal<CannonWorkerAPI>(null);\n\n\tbodies: { [uuid: string]: number } = {};\n\tevents: NgtcCannonEvents = {};\n\trefs: Refs = {};\n\tscaleOverrides: ScaleOverrides = {};\n\tsubscriptions: Subscriptions = {};\n\tworker = this.cannonWorker.asReadonly();\n\n\tconstructor() {\n\t\tconst injector = inject(Injector);\n\n\t\t// NOTE: set new cannonworker in afterNextRender\n\t\t// - so inputs are resolved\n\t\t// - so the worker is instantiated only once\n\t\t// - effects are started after worker is instantiated\n\t\tafterNextRender(() => {\n\t\t\tthis.cannonWorker.set(new CannonWorkerAPI(this.options()));\n\n\t\t\teffect(\n\t\t\t\t(onCleanup) => {\n\t\t\t\t\tconst cleanup = this.connectWorkerEffect();\n\t\t\t\t\tonCleanup(() => cleanup?.());\n\t\t\t\t},\n\t\t\t\t{ injector },\n\t\t\t);\n\n\t\t\teffect(\n\t\t\t\t() => {\n\t\t\t\t\tthis.updateWorkerStateEffect('axisIndex', this.axisIndex);\n\t\t\t\t\tthis.updateWorkerStateEffect('broadphase', this.broadphase);\n\t\t\t\t\tthis.updateWorkerStateEffect('gravity', this.gravity);\n\t\t\t\t\tthis.updateWorkerStateEffect('iterations', this.iterations);\n\t\t\t\t\tthis.updateWorkerStateEffect('tolerance', this.tolerance);\n\t\t\t\t},\n\t\t\t\t{ injector },\n\t\t\t);\n\t\t});\n\n\t\tlet timeSinceLastCalled = 0;\n\t\tinjectBeforeRender(({ delta }) => {\n\t\t\tconst [{ isPaused, maxSubSteps, stepSize }, worker] = [this.options(), this.cannonWorker()];\n\t\t\tif (isPaused || !worker || stepSize == null) return;\n\t\t\ttimeSinceLastCalled += delta;\n\t\t\tworker.step({ maxSubSteps, stepSize, timeSinceLastCalled });\n\t\t\ttimeSinceLastCalled = 0;\n\t\t});\n\t}\n\n\tprivate connectWorkerEffect() {\n\t\tconst worker = this.cannonWorker() as NgtcCannonWorker;\n\t\tif (!worker) return;\n\n\t\tworker.connect();\n\t\tworker.init();\n\n\t\tworker.on('collide', this.collideHandler.bind(this));\n\t\tworker.on('collideBegin', this.collideBeginHandler.bind(this));\n\t\tworker.on('collideEnd', this.collideEndHandler.bind(this));\n\t\tworker.on('frame', this.frameHandler.bind(this));\n\t\tworker.on('rayhit', this.rayhitHandler.bind(this));\n\n\t\treturn () => {\n\t\t\tworker.terminate();\n\t\t\tworker.removeAllListeners();\n\t\t};\n\t}\n\n\tprivate updateWorkerStateEffect<TUpdatableKey extends NgtsPhysicsUpdatableOptions>(\n\t\tkey: TUpdatableKey,\n\t\toption: () => NgtcPhysicsOptions[TUpdatableKey],\n\t) {\n\t\tconst worker = this.cannonWorker();\n\t\tif (!worker) return;\n\t\tObject.assign(worker, { [key]: option() });\n\t}\n\n\tprivate collideHandler({ body, contact: { bi, bj, ...contactRest }, target, ...rest }: WorkerCollideEvent['data']) {\n\t\tconst { events, refs } = this;\n\t\tconst cb = events[target]?.collide;\n\t\tif (cb) {\n\t\t\tcb({\n\t\t\t\tbody: refs[body],\n\t\t\t\tcontact: { bi: refs[bi], bj: refs[bj], ...contactRest },\n\t\t\t\ttarget: refs[target],\n\t\t\t\t...rest,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate collideBeginHandler({ bodyA, bodyB }: WorkerCollideBeginEvent['data']) {\n\t\tconst { events, refs } = this;\n\t\tconst cbA = events[bodyA]?.collideBegin;\n\t\tif (cbA) cbA({ body: refs[bodyB], op: 'event', target: refs[bodyA], type: 'collideBegin' });\n\t\tconst cbB = events[bodyB]?.collideBegin;\n\t\tif (cbB) cbB({ body: refs[bodyA], op: 'event', target: refs[bodyB], type: 'collideBegin' });\n\t}\n\n\tprivate collideEndHandler({ bodyA, bodyB }: WorkerCollideEndEvent['data']) {\n\t\tconst { events, refs } = this;\n\t\tconst cbA = events[bodyA]?.collideEnd;\n\t\tif (cbA) cbA({ body: refs[bodyB], op: 'event', target: refs[bodyA], type: 'collideEnd' });\n\t\tconst cbB = events[bodyB]?.collideEnd;\n\t\tif (cbB) cbB({ body: refs[bodyA], op: 'event', target: refs[bodyB], type: 'collideEnd' });\n\t}\n\n\tprivate frameHandler({\n\t\tactive,\n\t\tbodies: uuids = [],\n\t\tobservations,\n\t\tpositions,\n\t\tquaternions,\n\t}: WorkerFrameMessage['data']) {\n\t\tconst [{ shouldInvalidate }, { bodies, subscriptions, refs, scaleOverrides }, invalidate] = [\n\t\t\tuntracked(this.options),\n\t\t\tthis,\n\t\t\tthis.invalidate(),\n\t\t];\n\t\tfor (let i = 0; i < uuids.length; i++) {\n\t\t\tbodies[uuids[i]] = i;\n\t\t}\n\t\tobservations.forEach(([id, value, type]) => {\n\t\t\tconst subscription = subscriptions[id] || {};\n\t\t\tconst cb = subscription[type];\n\t\t\t// @ts-expect-error - We clearly know the type of the callback, but typescript can't deal with it\n\t\t\tcb && cb(value);\n\t\t});\n\t\tif (!active) return;\n\t\tfor (const ref of Object.values(refs).filter(unique())) {\n\t\t\tif (is.three<THREE.InstancedMesh>(ref, 'isInstancedMesh')) {\n\t\t\t\tfor (let i = 0; i < ref.count; i++) {\n\t\t\t\t\tconst uuid = `${ref.uuid}/${i}`;\n\t\t\t\t\tconst index = bodies[uuid];\n\t\t\t\t\tif (index !== undefined) {\n\t\t\t\t\t\tref.setMatrixAt(i, apply(index, positions, quaternions, scaleOverrides[uuid]));\n\t\t\t\t\t\tref.instanceMatrix.needsUpdate = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst scale = scaleOverrides[ref.uuid] || ref.scale;\n\t\t\t\tapply(bodies[ref.uuid], positions, quaternions, scale, ref);\n\t\t\t}\n\t\t}\n\t\tif (shouldInvalidate) invalidate();\n\t}\n\n\tprivate rayhitHandler({ body, ray: { uuid, ...rayRest }, ...rest }: WorkerRayhitEvent['data']) {\n\t\tconst { events, refs } = this;\n\t\tconst cb = events[uuid]?.rayhit;\n\t\tif (cb) cb({ body: body ? refs[body] : null, ray: { uuid, ...rayRest }, ...rest });\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAoCA,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE;AAC7B,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACpC,MA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AAE,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC;;8GAlKvE,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAX,WAAW,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBADvB,SAAS;mBAAC,EAAE,QAAQ,EAAE,cAAc,EAAE;;;AC5GvC;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,65 +1,65 @@
1
1
  {
2
- "name": "angular-three-cannon",
3
- "version": "4.0.0-next.2",
4
- "publishConfig": {
5
- "access": "public"
6
- },
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/angular-threejs/angular-three/tree/main/libs/cannon"
10
- },
11
- "author": {
12
- "name": "Chau Tran",
13
- "email": "nartc7789@gmail.com",
14
- "url": "https://nartc.me"
15
- },
16
- "description": "Physics Cannon for Angular Three",
17
- "keywords": [
18
- "angular",
19
- "threejs",
20
- "renderer",
21
- "cannon",
22
- "physics"
23
- ],
24
- "license": "MIT",
25
- "peerDependencies": {
26
- "@angular/common": ">=19.0.0 <20.0.0",
27
- "@angular/core": ">=19.0.0 <20.0.0",
28
- "@pmndrs/cannon-worker-api": "^2.0.0",
29
- "cannon-es": ">=0.20.0 <0.21.0",
30
- "cannon-es-debugger": "^1.0.0",
31
- "three": ">=0.148.0 <0.173.0"
32
- },
33
- "peerDependenciesMeta": {
34
- "cannon-es-debugger": {
35
- "optional": true
36
- }
37
- },
38
- "dependencies": {
39
- "tslib": "^2.7.0"
40
- },
41
- "sideEffects": false,
42
- "module": "fesm2022/angular-three-cannon.mjs",
43
- "typings": "index.d.ts",
44
- "exports": {
45
- "./package.json": {
46
- "default": "./package.json"
47
- },
48
- ".": {
49
- "types": "./index.d.ts",
50
- "default": "./fesm2022/angular-three-cannon.mjs"
51
- },
52
- "./body": {
53
- "types": "./body/index.d.ts",
54
- "default": "./fesm2022/angular-three-cannon-body.mjs"
55
- },
56
- "./constraint": {
57
- "types": "./constraint/index.d.ts",
58
- "default": "./fesm2022/angular-three-cannon-constraint.mjs"
59
- },
60
- "./debug": {
61
- "types": "./debug/index.d.ts",
62
- "default": "./fesm2022/angular-three-cannon-debug.mjs"
63
- }
64
- }
65
- }
2
+ "name": "angular-three-cannon",
3
+ "version": "4.0.0-next.20",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/angular-threejs/angular-three/tree/main/libs/cannon"
10
+ },
11
+ "author": {
12
+ "name": "Chau Tran",
13
+ "email": "nartc7789@gmail.com",
14
+ "url": "https://nartc.me"
15
+ },
16
+ "description": "Physics Cannon for Angular Three",
17
+ "keywords": [
18
+ "angular",
19
+ "threejs",
20
+ "renderer",
21
+ "cannon",
22
+ "physics"
23
+ ],
24
+ "license": "MIT",
25
+ "peerDependencies": {
26
+ "@angular/common": ">=19.0.0 <20.0.0",
27
+ "@angular/core": ">=19.0.0 <20.0.0",
28
+ "@pmndrs/cannon-worker-api": "^2.0.0",
29
+ "cannon-es": ">=0.20.0 <0.21.0",
30
+ "cannon-es-debugger": "^1.0.0",
31
+ "three": ">=0.148.0 <0.174.0"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "cannon-es-debugger": {
35
+ "optional": true
36
+ }
37
+ },
38
+ "dependencies": {
39
+ "tslib": "^2.7.0"
40
+ },
41
+ "sideEffects": false,
42
+ "module": "fesm2022/angular-three-cannon.mjs",
43
+ "typings": "index.d.ts",
44
+ "exports": {
45
+ "./package.json": {
46
+ "default": "./package.json"
47
+ },
48
+ ".": {
49
+ "types": "./index.d.ts",
50
+ "default": "./fesm2022/angular-three-cannon.mjs"
51
+ },
52
+ "./body": {
53
+ "types": "./body/index.d.ts",
54
+ "default": "./fesm2022/angular-three-cannon-body.mjs"
55
+ },
56
+ "./constraint": {
57
+ "types": "./constraint/index.d.ts",
58
+ "default": "./fesm2022/angular-three-cannon-constraint.mjs"
59
+ },
60
+ "./debug": {
61
+ "types": "./debug/index.d.ts",
62
+ "default": "./fesm2022/angular-three-cannon-debug.mjs"
63
+ }
64
+ }
65
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Angular Three
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.