https://github.com/node-3d/3d-bullet-raub
Bullet physics plugin for Node.js 3D Core
https://github.com/node-3d/3d-bullet-raub
bullet bullet-physics node-3d plugin
Last synced: 3 months ago
JSON representation
Bullet physics plugin for Node.js 3D Core
- Host: GitHub
- URL: https://github.com/node-3d/3d-bullet-raub
- Owner: node-3d
- License: mit
- Created: 2018-01-13T18:56:07.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-11-28T08:16:33.000Z (almost 2 years ago)
- Last Synced: 2024-04-25T16:43:19.080Z (over 1 year ago)
- Topics: bullet, bullet-physics, node-3d, plugin
- Language: JavaScript
- Homepage: https://github.com/node-3d/node-3d
- Size: 10.3 MB
- Stars: 1
- Watchers: 4
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Node.js 3D Bullet
This is a part of [Node3D](https://github.com/node-3d) project.
[](https://badge.fury.io/js/3d-bullet-raub)
[](https://github.com/node-3d/3d-bullet-raub/actions/workflows/eslint.yml)
[](https://github.com/node-3d/3d-bullet-raub/actions/workflows/test.yml)
```console
npm i -s 3d-bullet-raub
```
Bullet physics plugin for Node.js 3D Core

This plugin provides the `Shape` class to simplify the common use cases with Three.js and
Bullet Physics addon.
* Can display debug shapes.
* Updates mesh pose from physics engine.
* Removes meshes when the body is destroyed.
* `Shape` extends `Body` and works with `scene.hit()/scene.trace()`.
```ts
import * as three from 'three';
import { init, addThreeHelpers } from '3d-core-raub';
import { init as initBullet } from '3d-bullet-raub';
const { gl, loop, Screen } = init();
addThreeHelpers(three, gl);
const { scene, Shape } = initBullet({ three });
const screen = new Screen({ three });
const plane = new Shape({
sceneThree: screen.scene,
color: 0xface8d,
type: 'plane',
debug: 'solid',
});
const box = new Shape({
sceneThree: screen.scene,
pos: [0, 10, 0], // use { xyz } or [xyz]
mass: 3,
debug: 'solid',
color: 0xbeefed,
size: { x: 3, y: 2, z: 1 }, // use { xyz } or [xyz]
});
loop(() => {
scene.update();
screen.draw();
});
```
* See [TypeScript declarations](/index.d.ts) for more details.
* See [example](/examples/main.ts) for a complete setup.