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

@djodjonx/gwen-plugin-physics2d

v1.0.0

Published

2D physics plugin for GWEN — Rapier2D via WASM

Readme

@djodjonx/gwen-plugin-physics2d

2D physics plugin for GWEN (Rapier2D + WASM).

This documentation is plugin-specific, not engine-wide.

Installation

pnpm add @djodjonx/gwen-plugin-physics2d

Quick start

import { defineConfig } from '@djodjonx/gwen-kit';
import { physics2D } from '@djodjonx/gwen-plugin-physics2d';

export default defineConfig({
  plugins: [
    physics2D({
      gravity: -9.81,
      gravityX: 0,
      maxEntities: 10000,
      qualityPreset: 'medium',
      eventMode: 'pull',
      coalesceEvents: true,
    }),
  ],
});

What the plugin provides

  • physics service (runtime API): bodies, colliders, velocity, impulses, collision batches.
  • Global hooks: physics:collision, physics:collision:batch, physics:sensor:changed.
  • Prefab extension extensions.physics with legacy bridge + vNext colliders[].
  • Material presets: default, ice, rubber.
  • Tilemap helpers and chunk streaming runtime.
  • Systems: createPhysicsKinematicSyncSystem() and createPlatformerGroundedSystem().

Tree-shakable imports (Sprint 8)

import { physics2D } from '@djodjonx/gwen-plugin-physics2d/core';
import { buildTilemapPhysicsChunks } from '@djodjonx/gwen-plugin-physics2d/tilemap';
import { PHYSICS_MATERIAL_PRESETS } from '@djodjonx/gwen-plugin-physics2d/debug';

Available entry points:

  • @djodjonx/gwen-plugin-physics2d (full)
  • @djodjonx/gwen-plugin-physics2d/core
  • @djodjonx/gwen-plugin-physics2d/helpers
  • @djodjonx/gwen-plugin-physics2d/tilemap
  • @djodjonx/gwen-plugin-physics2d/debug

Key config options

  • qualityPreset?: 'low' | 'medium' | 'high' | 'esport'
  • ccdEnabled?: boolean (global fallback)
  • coalesceEvents?: boolean
  • eventMode?: 'pull' | 'hybrid'
  • compat?: { legacyPrefabColliderProps?: boolean; legacyCollisionJsonParser?: boolean }

Recommended runtime pattern

  1. Declare physics in prefabs with extensions.physics.colliders[].
  2. Use physics.getCollisionEventsBatch() in gameplay systems.
  3. Keep getCollisionEvents() only for legacy compatibility.
  4. Use tilemap chunk helpers for large maps; patch chunks incrementally.

Prefab example (vNext)

import { definePrefab } from '@djodjonx/gwen-engine-core';

export const BulletPrefab = definePrefab({
  name: 'Bullet',
  extensions: {
    physics: {
      bodyType: 'dynamic',
      ccdEnabled: true,
      colliders: [{ shape: 'ball', radius: 4 }],
      onCollision(self, _other, contact, api) {
        if (!contact.started) return;
        api.destroyEntity(self);
      },
    },
  },
  create: (api, x: number, y: number) => {
    const id = api.createEntity();
    api.addComponent(id, 'position', { x, y });
    return id;
  },
});

Documentation index

  • API: docs/API.md
  • Migration: docs/MIGRATION.md
  • Tilemap: docs/TILEMAP.md
  • Hooks: docs/hooks.md
  • Systems: docs/systems.md