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

@millsydotdev/spark

v0.1.1

Published

Spark Physics Engine — A 3D rigid body physics engine for the web, built on WASM

Readme

Spark Physics Engine

A high-performance 3D rigid body physics engine for the web, compiled to WebAssembly with SIMD support.

Spark is a standalone physics engine (inspired by Box3D) with TypeScript-first API design, optimized for browser and Node.js environments.

Features

  • Rigid body simulation — static, dynamic, kinematic bodies
  • Collision shapes — box, sphere, capsule, cylinder, convex hull, mesh (trimesh)
  • Joints — revolute (hinge), distance (spring), spherical (ball-socket), prismatic (slider), weld, motor, wheel, parallel
  • Raycasting — single-hit (castRay) and multi-hit (castRayAll)
  • Collision events — begin/end contact callbacks
  • Sensor triggers — enter/exit events for volume detection
  • Per-body properties — gravity scale, linear/angular damping, CCD (bullet mode)
  • Runtime property changes — friction, restitution, collision filters
  • Sleep management — automatic body sleeping for CPU savings
  • SIMD acceleration — SSE2/Neon via WASM SIMD
  • Multithreading — optional pthreads-based parallel solver (deluxe build)
  • Deterministic — reproducible simulations across platforms and thread counts

Installation

npm install @millsydotdev/spark

Quick Start

import { SparkPhysicsWorld } from '@millsydotdev/spark';

const world = new SparkPhysicsWorld({
  gravity: { x: 0, y: -9.81, z: 0 },
});

await world.init();

const ground = world.createRigidBody({
  bodyType: 'static',
  position: { x: 0, y: -0.5, z: 0 },
});
world.createCollider({
  shape: { kind: 'box', halfExtents: { x: 20, y: 0.5, z: 20 } },
  friction: 0.5,
}, ground);

const ball = world.createRigidBody({
  bodyType: 'dynamic',
  position: { x: 0, y: 5, z: 0 },
});
world.createCollider({
  shape: { kind: 'sphere', radius: 0.5 },
  restitution: 0.8,
}, ball);

// Step the simulation
world.step(1 / 60);

// Ball has fallen
console.log(ball.position()); // { x: ~0, y: ~0.5, z: ~0 }

API

SparkPhysicsWorld

| Method | Description | |--------|-------------| | init() | Loads WASM and initializes the physics world | | step(dt) | Advances simulation by dt seconds | | createRigidBody(descriptor) | Creates a rigid body | | removeRigidBody(body) | Removes a rigid body | | createCollider(descriptor, body) | Attaches a collider shape to a body | | removeCollider(collider) | Removes a collider | | createTriggerVolume(descriptor) | Creates a trigger/sensor volume | | removeTriggerVolume(volume) | Removes a trigger volume | | castRay(input) | Casts a ray, returns closest hit | | castRayAll(input) | Casts a ray, returns all hits | | bodyList | Array of all rigid bodies | | colliderList | Array of all colliders | | onCollisionEnter/Exit | Collision event callbacks | | destroy() | Cleans up all resources |

Supported Collider Shapes

  • box — box with half-extents
  • sphere — sphere with radius
  • capsule — capsule with half-height and radius
  • cylinder — cylinder with half-height and radius
  • convexHull — convex hull from vertex array
  • trimesh — triangle mesh from vertices and indices

Body Properties (Runtime Settable)

  • setGravityScale(scale) — per-body gravity multiplier
  • setLinearDamping(damping) — linear velocity damping
  • setAngularDamping(damping) — angular velocity damping
  • setLinearVelocity(velocity) — set linear velocity
  • applyForce(force, point) — apply force at world point
  • applyImpulse(impulse, point) — apply impulse at world point

Collider Properties (Runtime Settable)

  • setFriction(friction) — change friction coefficient
  • setRestitution(restitution) — change bounciness
  • setCollisionGroups(membership, filter) — change collision filtering
  • setSensor(enabled) — toggle sensor mode

Build from Source

git clone https://github.com/millsydotdev/spark.git
cd spark
npm install
npm run build:wasm   # Build the WASM binary (requires Docker)
npm run build        # Build TypeScript + WASM
npm test             # Run tests

License

MIT