{"_id":"@aperture-engine/physics","_rev":"3-05486bab8a82f10dbd4e55cbe7d13f20","name":"@aperture-engine/physics","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@aperture-engine/physics","version":"0.1.0","keywords":["aperture","physics","ecs","rigid-body","collider","game-engine","typescript"],"author":{"name":"Felix Zhang"},"license":"MIT","_id":"@aperture-engine/physics@0.1.0","maintainers":[{"name":"felixtrz","email":"felixtrz96@gmail.com"}],"homepage":"https://github.com/felixtrz/aperture/tree/main/packages/physics#readme","bugs":{"url":"https://github.com/felixtrz/aperture/issues"},"dist":{"shasum":"a618ba6763fd3f3175cc1155fd20d2952522f3bc","tarball":"https://registry.npmjs.org/@aperture-engine/physics/-/physics-0.1.0.tgz","fileCount":87,"integrity":"sha512-xCD92Imvg2Xj86wr5B5d9lfqhIcBUGzQk6r+2eRAU0Wi8ZAe0kK0NxlHjozOlaoDrHr7Hyz6xqB/i1z2HKcsTw==","signatures":[{"sig":"MEUCIQCUuSgRXqMNv2zCwXevcGW7K0/CYVu84Z5ZZMxWTu4+tAIgelSovhG7WWEKh0K3f4Eup4LxO1pVQg4dWLJQjoy0vWs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":739757},"main":"./dist/index.js","type":"module","_from":"file:aperture-engine-physics-0.1.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./testing":{"types":"./dist/testing.d.ts","import":"./dist/testing.js"}},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc --noEmit -p tsconfig.json"},"_npmUser":{"name":"felixtrz","email":"felixtrz96@gmail.com"},"_resolved":"/private/var/folders/xc/nttyc9pj3xngmbjsfbgdbddc0000gn/T/7d3022ea991288920bccde8d2aaf6ce5/aperture-engine-physics-0.1.0.tgz","_integrity":"sha512-xCD92Imvg2Xj86wr5B5d9lfqhIcBUGzQk6r+2eRAU0Wi8ZAe0kK0NxlHjozOlaoDrHr7Hyz6xqB/i1z2HKcsTw==","repository":{"url":"git+https://github.com/felixtrz/aperture.git","type":"git","directory":"packages/physics"},"_npmVersion":"11.12.1","description":"Backend-neutral physics components, fixed-step scheduling, and backend contracts for Aperture.","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","dependencies":{"@aperture-engine/simulation":"^0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/physics_0.1.0_1782151616766_0.11845944278420495","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@aperture-engine/physics","version":"0.2.0","keywords":["aperture","physics","ecs","rigid-body","collider","game-engine","typescript"],"author":{"name":"Felix Zhang"},"license":"MIT","_id":"@aperture-engine/physics@0.2.0","maintainers":[{"name":"felixtrz","email":"felixtrz96@gmail.com"}],"homepage":"https://github.com/felixtrz/aperture/tree/main/packages/physics#readme","bugs":{"url":"https://github.com/felixtrz/aperture/issues"},"dist":{"shasum":"43320aa5c954208ca45db522e40cd2ef97e17b9f","tarball":"https://registry.npmjs.org/@aperture-engine/physics/-/physics-0.2.0.tgz","fileCount":87,"integrity":"sha512-v8CfYVMaUsR7e+dibJLP/Kin+M6GByY38VjeTslZygDcqTow/t6l6f9KvuP1jidRbIm4RM04HkN9JvI0RrNYSw==","signatures":[{"sig":"MEUCIQD3uWrwIVpNzW+IKua1iaJeCKyFgN9eIM1BUuKaYmrG3wIgd3AA30dN99A4H2h8hVG0mhKjkmMVtklPB43bGHys7JQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":739757},"main":"./dist/index.js","type":"module","_from":"file:aperture-engine-physics-0.2.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./testing":{"types":"./dist/testing.d.ts","import":"./dist/testing.js"}},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc --noEmit -p tsconfig.json"},"_npmUser":{"name":"felixtrz","email":"felixtrz96@gmail.com"},"_resolved":"/private/var/folders/xc/nttyc9pj3xngmbjsfbgdbddc0000gn/T/c61fec1599be7164bc09693dbd045aea/aperture-engine-physics-0.2.0.tgz","_integrity":"sha512-v8CfYVMaUsR7e+dibJLP/Kin+M6GByY38VjeTslZygDcqTow/t6l6f9KvuP1jidRbIm4RM04HkN9JvI0RrNYSw==","repository":{"url":"git+https://github.com/felixtrz/aperture.git","type":"git","directory":"packages/physics"},"_npmVersion":"11.12.1","description":"Backend-neutral physics components, fixed-step scheduling, and backend contracts for Aperture.","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","dependencies":{"@aperture-engine/simulation":"^0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/physics_0.2.0_1782246150867_0.6691839438378084","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@aperture-engine/physics","version":"0.3.0","description":"Backend-neutral physics components, fixed-step scheduling, and backend contracts for Aperture.","author":{"name":"Felix Zhang"},"repository":{"type":"git","url":"git+https://github.com/felixtrz/aperture.git","directory":"packages/physics"},"homepage":"https://github.com/felixtrz/aperture/tree/main/packages/physics#readme","bugs":{"url":"https://github.com/felixtrz/aperture/issues"},"keywords":["aperture","physics","ecs","rigid-body","collider","game-engine","typescript"],"type":"module","license":"MIT","sideEffects":false,"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./testing":{"types":"./dist/testing.d.ts","import":"./dist/testing.js"},"./package.json":"./package.json"},"main":"./dist/index.js","types":"./dist/index.d.ts","publishConfig":{"access":"public"},"dependencies":{"@aperture-engine/simulation":"^0.3.0"},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc --noEmit -p tsconfig.json"},"_id":"@aperture-engine/physics@0.3.0","_integrity":"sha512-SMl5J/hm7h03ffX1FKf34NVlZWE4wIRXPOko39DtcQexRnHg7LKh84711LNtwm+cSpyP0L8Ld8/kBPaPgWYLHw==","_resolved":"/private/var/folders/xc/nttyc9pj3xngmbjsfbgdbddc0000gn/T/78b76137d10b8832f9ac2f594a841b61/aperture-engine-physics-0.3.0.tgz","_from":"file:aperture-engine-physics-0.3.0.tgz","_nodeVersion":"26.0.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-SMl5J/hm7h03ffX1FKf34NVlZWE4wIRXPOko39DtcQexRnHg7LKh84711LNtwm+cSpyP0L8Ld8/kBPaPgWYLHw==","shasum":"2cfba607df99278134baabe0eac43c6f03b71b24","tarball":"https://registry.npmjs.org/@aperture-engine/physics/-/physics-0.3.0.tgz","fileCount":91,"unpackedSize":749430,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD9NzxpkxAq/2//yuQ6uLKVw5XGs4tdSfIn7VM/xUlrMQIgPN0m14kR7MkL084dsYc0tIcyyV3459ViL7KWM2nwEiU="}]},"_npmUser":{"name":"felixtrz","email":"felixtrz96@gmail.com"},"directories":{},"maintainers":[{"name":"felixtrz","email":"felixtrz96@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/physics_0.3.0_1783122749957_0.405268053100337"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-22T18:06:56.576Z","modified":"2026-07-03T23:52:30.225Z","0.1.0":"2026-06-22T18:06:56.903Z","0.2.0":"2026-06-23T20:22:31.048Z","0.3.0":"2026-07-03T23:52:30.108Z"},"bugs":{"url":"https://github.com/felixtrz/aperture/issues"},"author":{"name":"Felix Zhang"},"license":"MIT","homepage":"https://github.com/felixtrz/aperture/tree/main/packages/physics#readme","keywords":["aperture","physics","ecs","rigid-body","collider","game-engine","typescript"],"repository":{"type":"git","url":"git+https://github.com/felixtrz/aperture.git","directory":"packages/physics"},"description":"Backend-neutral physics components, fixed-step scheduling, and backend contracts for Aperture.","maintainers":[{"name":"felixtrz","email":"felixtrz96@gmail.com"}],"readme":"# @aperture-engine/physics\n\nBackend-neutral physics components, fixed-step scheduling, and backend contracts for the Aperture engine.\n\n## Install\n\n```sh\npnpm add @aperture-engine/physics\n```\n\nThis package is part of the [Aperture](https://github.com/felixtrz/aperture) WebGPU game engine and is normally used together with the other `@aperture-engine/*` packages (it depends on `@aperture-engine/simulation` for the ECS world).\n\n## What it does\n\n`@aperture-engine/physics` provides the engine-agnostic authoring layer for physics: ECS components (rigid bodies, colliders, joints, character controllers, materials), helpers to build their initial data, a deterministic fixed-step clock, and the `PhysicsBackend` contract that a concrete simulation backend (e.g. Rapier) implements. It also drives the ECS-to-backend sync each tick and writes results back onto the world. No physics solver is bundled here — bring a backend, or use the built-in test backend from the `./testing` subpath.\n\n## Usage\n\n```ts\nimport {\n  registerPhysicsComponents,\n  RigidBody,\n  Collider,\n  createRigidBody,\n  createCollider,\n  createFixedStepClock,\n  advanceFixedStepClock,\n  createPhysicsWorldSyncState,\n  stepPhysicsWorld,\n} from \"@aperture-engine/physics\";\nimport { createTestPhysicsBackend } from \"@aperture-engine/physics/testing\";\n\n// Register the physics components on your ECS world.\nregisterPhysicsComponents(world);\n\n// Author an entity with a dynamic rigid body and a box collider.\nconst entity = world.createEntity();\nworld.addComponent(entity, RigidBody, createRigidBody({ type: \"dynamic\" }));\nworld.addComponent(\n  entity,\n  Collider,\n  createCollider({ shape: { kind: \"box\", halfExtents: [0.5, 0.5, 0.5] } }),\n);\n\n// Drive the simulation with a deterministic fixed-step clock and a backend.\nconst clock = createFixedStepClock({ fixedDelta: 1 / 60 });\nconst state = createPhysicsWorldSyncState();\nconst backend = createTestPhysicsBackend();\n\nconst advance = advanceFixedStepClock(clock, deltaSeconds);\nfor (let i = 0; i < advance.substeps; i++) {\n  stepPhysicsWorld({\n    world,\n    backend,\n    state,\n    fixedDelta: clock.fixedDelta,\n    fixedStep: clock.fixedStepIndex,\n  });\n}\n```\n\n## Entry points\n\n- `@aperture-engine/physics` — components, authoring helpers, fixed-step clock, ECS sync (`stepPhysicsWorld`), quaternion/vector math, validation, the `PhysicsBackend` contract, and worker transport helpers.\n- `@aperture-engine/physics/testing` — `createTestPhysicsBackend`, a pure-TypeScript reference backend useful for tests and headless simulation.\n\n## License\n\nPart of the [Aperture monorepo](https://github.com/felixtrz/aperture). MIT licensed.\n","readmeFilename":"README.md"}