npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@node-3d/plugin-bullet

v4.0.1

Published

Bullet Physics plugin for Node3D

Readme

Node3D Bullet Extension

This is a part of Node3D project.

NPM Lint Test

npm install @node-3d/core @node-3d/plugin-bullet three

@node-3d/plugin-bullet connects the rigid-body simulation in @node-3d/bullet to a Three.js scene managed by @node-3d/core. Use it when bodies should move Three.js objects or when you want simple visible physics debug shapes.

Example

The plugin creates one default Bullet scene and provides a Shape class. A Shape is a regular Bullet Body with optional Three.js integration:

  • Give it mesh to keep an existing THREE.Object3D synchronized with physics.
  • Give it sceneThree and debug to create a generated solid or wireframe debug mesh.
  • It still supports Bullet body options such as type, size, mass, pos, and velocities.

Quick start

Create a static ground shape and a dynamic box, step the Bullet scene each frame, then draw the Core screen. scene below is the Bullet scene; screen.scene is the Three.js scene.

import * as three from 'three';
import { Screen, addThreeHelpers, init } from '@node-3d/core';
import { init as initBullet } from '@node-3d/plugin-bullet';

const { loop } = init();
addThreeHelpers(three);

const screen = new Screen({ three });
const { scene, Shape } = initBullet({ three });

// A zero-mass body is static. The generated wireframe is added to screen.scene.
new Shape({
	sceneThree: screen.scene,
	type: 'plane',
	debug: 'wire',
	color: 0x4f81bd,
});

// A positive mass makes the box fall under the scene's default gravity.
const box = new Shape({
	sceneThree: screen.scene,
	pos: [0, 10, 0],
	mass: 3,
	debug: 'solid',
	color: 0xffb347,
	size: [3, 2, 1],
});

loop(() => {
	scene.update(); // advances Bullet and updates every active Shape
	screen.draw();
});

Use an explicit delta for deterministic/fixed-step simulation:

scene.update(1 / 60);

API

init({ three? })

Initializes the plugin once and returns a cached object. Pass the same three module used by your Core screen if you want Shape to create debug geometry.

| Value | Purpose | | --- | --- | | bullet | The complete low-level @node-3d/bullet module for advanced use, including Joint. | | scene | The default Bullet physics scene. Set scene.gravity, call scene.update(), or use scene.hit() / scene.trace(). | | Shape | A Body subclass that can synchronize an object or generate a Three.js debug mesh. |

Calling init() again returns the first result. Initialize it before creating shapes; later calls cannot replace its three module or default Bullet scene.

new Shape(options)

Shape accepts the normal @node-3d/bullet body properties plus the following plugin options:

| Option | Meaning | | --- | --- | | sceneBullet | Use this Bullet scene instead of the plugin's default scene. | | sceneThree | Three.js scene that receives a generated debug mesh. Required with debug. | | mesh | Existing THREE.Object3D to synchronize with the body transform. | | debug | 'solid' or 'wire' to create a generated debug mesh; omit it for no generated mesh. | | color | Three.js color for the generated debug mesh. |

The ordinary Bullet body options are the physics controls you will use most often:

  • type: 'box' (default), 'ball', 'roll', 'pill', or 'plane'.
  • size, pos, quat, and rot: shape dimensions and transform. Vectors accept either arrays such as [1, 2, 3] or objects such as { x: 1, y: 2, z: 3 }.
  • mass: 0 for static bodies; a positive value for dynamic bodies.
  • vell and vela: linear and angular velocity.
  • frict, rest, dampl, dampa, and sleepy: contact, damping, and sleep settings.

When Bullet emits a body update during scene.update(), the plugin copies its position and quaternion to mesh and to the generated debug mesh. Changing type or size rebuilds the generated debug geometry. Calling destroy() releases the Bullet body and hides/removes a supplied mesh from sceneThree.

Attach your own mesh

Use mesh when the visual should be a real Three.js model rather than the plugin's simple debug geometry. The plugin only owns transform synchronization; you retain ownership of model materials, geometry, and any additional scene behavior.

const mesh = new three.Mesh(
	new three.BoxGeometry(3, 2, 1),
	new three.MeshStandardMaterial({ color: 0xffb347 }),
);
screen.scene.add(mesh);

const crate = new Shape({
	mesh,
	pos: [0, 10, 0],
	mass: 3,
	size: [3, 2, 1],
});

crate.on('update', ({ pos, quat }) => {
	// Physics has advanced; mesh has already received this transform.
	console.log(pos, quat);
});

For a larger interactive scene, see examples/main.ts.