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

@scenoco-three/collision

v0.4.0

Published

Lightweight non-physics overlap detection for SceNoCo: <BoxTrigger>/<SphereTrigger> volumes + a TriggerSystem dispatching onTriggerEnter/onTriggerExit

Readme

@scenoco-three/collision

Lightweight, detection-only collision for SceNoCo — with an API identical to @scenoco-three/rapier so switching engines is just swapping the import. The same <RigidBody>/<BoxCollider> scene and the same onCollisionEnter / onTriggerEnter component code run on either package. This one detects overlaps and dispatches the contact hooks; it has no dynamics (bodies and gravity are inert). Zero dependencies.

npm i @scenoco-three/collision

Pick one engine. The tags share rapier's names on purpose, so importing both packages throws a duplicate-registration error — a project commits to one backend, the way Cocos Creator selects a physics engine. Use collision for cheap overlap without a physics dep; use rapier for real forces, resolution, and joints.

Colliders (same as rapier)

Every collider carries isSensor (bool) plus restitution / friction / density (accepted for rapier compatibility, inert here):

| Tag | Attributes | | --- | --- | | <BoxCollider> | halfExtents (vec3, 0.5 0.5 0.5) | | <SphereCollider> | radius (float, 0.5) | | <CapsuleCollider> | radius (0.5), halfHeight (0.5, along Y) | | <CylinderCollider> | radius (0.5), halfHeight (0.5, along Y) | | <PlaneCollider> | halfExtents (vec2, 5 5) — flat XZ, thin cuboid |

<RigidBody> (kind / linearDamping / angularDamping / gravityScale / ccd) and <Physics gravity> are also registered so a rapier scene drops in unchanged — but they are inert: nothing moves, there is no simulation. Colliders detect overlaps with or without a <RigidBody>; move nodes yourself (or with your own components).

  • Approximations (detection-only): boxes/planes are axis-aligned in scale (box rotation ignored); a cylinder is approximated as a capsule. Internally every shape is an AABB box or a swept-sphere capsule, so all pairs use three exact tests (box–box, capsule–capsule, box–capsule).

Events (same hooks rapier dispatches)

Any component on a collider's node may implement these — a solid pair fires the onCollision* pair, a sensor pair (either collider isSensor) fires onTrigger*. Each receives the other node:

import { Component, component } from '@scenoco-three/core';
import type { Object3D } from 'three';

@component({ name: 'Bullet', description: 'Despawns on impact' })
export class Bullet extends Component {
  onCollisionEnter(other: Object3D): void {
    this.engine.destroy(other); // hit something solid
    this.engine.destroy(this.node);
  }
  onTriggerEnter(_other: Object3D): void {}
}

onCollisionExit / onTriggerExit fire the frame an overlap ends, and on the surviving collider when the other is destroyed mid-overlap. This is byte-for-byte the rapier contact API, so behaviour code moves between the two engines with no changes.

Scene (a rapier scene, unchanged)

<Scene>
  <Physics gravity="0 -9.81 0" />               <!-- inert here; kept for drop-in -->
  <Mesh id="player"><BoxGeometry />
    <Components><RigidBody /><BoxCollider halfExtents="0.5 1 0.5" /></Components>
  </Mesh>
</Scene>

The CollisionSystem auto-runs while the scene (or a spawned prefab) holds any collider — no manual registration — and stops on scene unload. It runs on core's System seam via @system(Collider), exactly like the physics add-ons.

License

MIT