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

@codexo/exojs-physics

v0.15.3

Published

Native 2D collision, query and sensor runtime for ExoJS.

Readme

@codexo/exojs-physics

Native 2D collision, query and sensor runtime for ExoJS.

Zero production dependencies, ESM-only, version-locked with the core engine. This first release ships a complete collision/query world without dynamics: shapes, colliders, bodies, a broad phase, a manifold-generating narrow phase, collision filters, sensors, events, spatial queries, scene-node binding and a debug overlay. Forces, impulses and gravity integration (the rigid-body solver) arrive in a follow-up — the public surface here is forward-compatible with it.

Library, not an extension. Physics contributes no renderer or asset bindings, so there is no /register entry. Construct a PhysicsWorld directly. @codexo/exojs is a peer dependency.

Install

npm install @codexo/exojs @codexo/exojs-physics

Quick start

import { Scene, Sprite, Vector, type Time } from '@codexo/exojs';
import { BoxShape, CircleShape, Collider, PhysicsBody, PhysicsWorld } from '@codexo/exojs-physics';

class GameScene extends Scene {
  private readonly world = new PhysicsWorld({ gravity: new Vector(0, 980) });

  public override onStart(): void {
    // Construct bodies/colliders freely, then hand them to the world: `add`
    // assigns ids, registers the colliders and aggregates the mass model.
    // Static ground (an explicit static body + box collider).
    this.world.add(
      new PhysicsBody({ type: 'static', position: new Vector(400, 600), colliders: [new Collider({ shape: new BoxShape(800, 32), friction: 0.9 })] }),
    );

    // A kinematic platform you move yourself. Attach more colliders any time.
    const platform = new PhysicsBody({ type: 'kinematic', position: new Vector(200, 400) });
    platform.addCollider(new Collider({ shape: new BoxShape(120, 16) }));
    this.world.add(platform);

    // A sensor trigger.
    const triggerCollider = new Collider({ shape: new CircleShape(40), isSensor: true });
    this.world.add(new PhysicsBody({ type: 'static', position: new Vector(600, 500), colliders: [triggerCollider] }));
    this.world.onSensorEnter.add(({ sensor }) => {
      if (sensor === triggerCollider) console.log('entered the trigger');
    });
  }

  public override update(delta: Time): void {
    this.world.step(delta.seconds); // fixed-step detection + events + binding
  }
}

What it does

| Area | API | |---|---| | World | PhysicsWorld, step, gravity, timeStepper, destroy | | Bodies | new PhysicsBody + world.add (dynamic/static/kinematic), setTransform, mass/inertia from colliders | | Colliders | new Collider + body.addCollider / colliders: [...], density/friction/restitution, isSensor, filter, offset | | Attach | world.attach(node, def) — body + collider + bind in one call | | Shapes | CircleShape, PolygonShape (convex-validated), BoxShape | | Filtering | CollisionFilter (category/mask/group), shouldCollide | | Events | onCollisionStart / onCollisionEnd / onSensorEnter / onSensorExit — immutable snapshots | | Queries | queryPoint, queryAabb (+ out / forEachAabbHit), rayCast, rayCastAll, overlapShape | | Binding | bind(body, node) — node tracks the body's position each step | | Debug | @codexo/exojs-physics/debugPhysicsDebugDraw (shapes/AABBs/contacts/normals/centres/broad-phase) |

Determinism & non-goals

Stepping is fully caller-driven and uses a fixed timestep with an accumulator (world.step(frameDeltaSeconds)); the same build replays a scene identically given the same inputs. There are no rollback/lockstep determinism guarantees across builds or machines (floating-point reality). The package is single-threaded and 2D only — no workers, GPU, 3D, soft bodies, fluids or vehicles.

This release contains no dynamics solver: bodies move only via setTransform. The narrow phase already produces full contact manifolds (normal, 1–2 points, stable feature ids) so the solver can be added without changing the public API.

License

MIT © Codexo