{"id":22427253,"url":"https://github.com/node-3d/bullet-raub","last_synced_at":"2025-08-01T10:31:57.946Z","repository":{"id":29240816,"uuid":"116862453","full_name":"node-3d/bullet-raub","owner":"node-3d","description":"Bullet-driven physics API","archived":false,"fork":false,"pushed_at":"2023-11-27T18:13:43.000Z","size":195,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-27T21:13:03.013Z","etag":null,"topics":["addon","bindings","bullet","native","node-3d","physics"],"latest_commit_sha":null,"homepage":"https://github.com/node-3d/node-3d","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/node-3d.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-01-09T19:42:55.000Z","updated_at":"2024-10-18T19:45:00.000Z","dependencies_parsed_at":"2023-12-13T19:13:26.201Z","dependency_job_id":"de914948-9e14-4fc2-acef-5cdedb5a0c09","html_url":"https://github.com/node-3d/bullet-raub","commit_stats":{"total_commits":79,"total_committers":4,"mean_commits":19.75,"dds":"0.44303797468354433","last_synced_commit":"f3b3486b4fb788a4afc55b10b02dfae8c6e77b3c"},"previous_names":["raub/node-bullet"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-3d%2Fbullet-raub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-3d%2Fbullet-raub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-3d%2Fbullet-raub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-3d%2Fbullet-raub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-3d","download_url":"https://codeload.github.com/node-3d/bullet-raub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228214807,"owners_count":17886344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["addon","bindings","bullet","native","node-3d","physics"],"created_at":"2024-12-05T20:11:17.867Z","updated_at":"2025-08-01T10:31:57.930Z","avatar_url":"https://github.com/node-3d.png","language":"C++","readme":"# Bullet Physics for Node.js\n\nThis is a part of [Node3D](https://github.com/node-3d) project.\n\n[![NPM](https://badge.fury.io/js/bullet-raub.svg)](https://badge.fury.io/js/bullet-raub)\n[![ESLint](https://github.com/node-3d/bullet-raub/actions/workflows/eslint.yml/badge.svg)](https://github.com/node-3d/bullet-raub/actions/workflows/eslint.yml)\n[![Test](https://github.com/node-3d/bullet-raub/actions/workflows/test.yml/badge.svg)](https://github.com/node-3d/bullet-raub/actions/workflows/test.yml)\n[![Cpplint](https://github.com/node-3d/bullet-raub/actions/workflows/cpplint.yml/badge.svg)](https://github.com/node-3d/bullet-raub/actions/workflows/cpplint.yml)\n\n```console\nnpm i -s bullet-raub\n```\n\n\u003e This addon is ABI-compatible across Node.js versions. **There is no compilation** during `npm i`.\n\n**Node.js** addon providing a Bullet-driven physics API.\n\nThis library is a simplified interpretation of\n[Bullet Physics](https://github.com/bulletphysics/bullet3).\nOnly rigid bodies and DOF-6 constraint are supported.\n\n\n# Details\n\nOnly rigid body primitives are supported. The API is simplified to just 3 classes: `Scene, Body, Joint`.\nBody can be static or dynamic and with different shapes. Joint is a DOF6 that you can set up in\nmany possible ways.\n\nSee [TypeScript declarations](/index.d.ts) for more details.\n\n\n## Creating Scenes:\n\n```ts\nconst scene = new Scene();\nscene.gravity = [0, -9.8, 0];\nconst frame = () =\u003e {\n\tscene.update(); // \u003c-- call update() to progress simulation!\n\tsetTimeout(frame, 15);\n};\nframe();\n```\n\nThe `scene` contains all bodies and joints. It is a high-level wrapper that initializes:\n\n* `btDefaultCollisionConfiguration`\n* `btCollisionDispatcher`\n* `btBroadphaseInterface`\n* `btConstraintSolver`\n* `btDynamicsWorld`\n\nFrom `scene` you can also run ray hits or traces. It should be possible to use many scenes\nin parallel.\n\n```ts\nconst { body } = scene.hit(start, end);\n```\n\nHere `body` is whatever `Body` the ray hits first on its path. For subclasses of `Body`,\nthis will respect the dynamic type. I.e. for `class House extends Body {...}` the expression\n`body instanceof House` will be `true`.\nSee `scene.hit` and `scene.trace` in the [example](/examples/main.ts).\n\n## Adding Bodies\n\n```ts\nconst plane = new Body({ scene }); // static box\nplane.type = 'plane'; // change shape to (\"ground\") plane\n\nconst box = new Body({ scene }); // 'box' is default type\nbox.pos = [0, 100, 0]; // 100 meters above\nbox.mass = 1; // becomes dynamic\n```\n\nPass `scene` as a required constructor option. All bodies always exist within their parent scenes.\n\n\n## Connecting Joints\n\n```ts\nconst joint = new Joint();\njoint.minl = [0, 1, 0];\njoint.maxl = [0, 1, 0];\njoint.a = bodyA;\njoint.b = bodyB;\n```\n\nThis will connect `bodyA` and `bodyB` and constrain their origins to always be 1 meter apart.\nYou can also change the origin offsets, add rotation constraints and many other joint parameters.\n\n\n## Events\n\nObjects of `Scene, Body, Joint` - all have events for every property modification. E.g.\nas soon as you set `scene.gravity=[0,0,0]`, and event will fire for `scene.on('gravity', () =\u003e {...})`.\n\nYou should call `scene.update(dt: number = 0.0)` in order for the scene to progress. Here `dt`\nis optional delta time in seconds. If not provided, `dt` will be calculated from internal timers.\nIt is during this call to `scene.update()` the below `'update'` events will fire.\n\nObjects of `Body` will fire `'update'` events every tick while not sleeping:\n\n```ts\nbody.on('update', (event) =\u003e {\n\tevent.pos; // position of body origin (usually center)\n\tevent.quat; // rotation quaternion\n\tevent.vell; // linear velocity (where it goes)\n\tevent.vela; // angular velocity (how much it spins)\n});\n```\n\nThis is mostly designed to be fed into visualization APIs (such as Three.js), therefore\na Quaternion is used to represent rotation. You may need linear/angular velocity for\ninterpolation, shading, networking, etc.\n\nObjects of `Joint` will fire `'update'` events every tick while not sleeping:\n\n```ts\njoint.on('update', (event) =\u003e {\n\tevent.posa; // current position of body A\n\tevent.posb; // current position of body B\n\tevent.broken; // boolean, is this joint broken\n});\n```\n\nJoints can be broken when overwhelmed with impulse. This is controlled by `joint.maximp` -\nby default it's very high. But you can lower it so that, for instance, car wheels fall off\nupon extreme impact.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-3d%2Fbullet-raub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-3d%2Fbullet-raub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-3d%2Fbullet-raub/lists"}