Skip to content
Notifications You must be signed in to change notification settings

sadeshmukh/qubed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

68db7c6 · · Aug 5, 2025

History

19 Commits
Aug 5, 2025
Aug 3, 2025
Aug 5, 2025
Jul 17, 2025
Aug 4, 2025
Aug 5, 2025
Jul 15, 2025
Jul 15, 2025
Aug 5, 2025
Jul 15, 2025

Repository files navigation

Qubed

A 2D physics simulation built with TypeScript. Simulates rigid body dynamics with collision detection and response for boxes, <10-sided polygons, and walls.ls.

WARNING: It is very buggy, especially at high velocities, and especially so with lots of objects (> 20). Otherwise, it should work mostly alright. note for future me: if node isn't working, update tool-versions (removed for cloudflare)re))

Architecture

The engine is organized into several core modules:

  • Core: Foundation classes for physics objects

    • RigidBody: Handles mass, velocity, and angular motion
    • Vector: 2D vector math operations
    • Object: Base class for all physics objects
  • Shapes: Geometric primitives

    • Box: Rectangular rigid bodies
    • NGon: N-sided polygon shapes (triangles, pentagons, hexagons, etc.)
    • Wall: Static boundaries
  • Collision: Physics calculations

    • CollisionSystem: Detects intersections between objects
    • CollisionInfo: Stores collision data for resolution
  • Simulation: Core engine

    • World: Manages objects, handles updates, and renders the simulation
  • Rendering: Visual output

    • DrawingUtils: Canvas drawing utilities

Setup

  1. Install dependencies:

    npm install
  2. Start development server:

    npm run dev
  3. Build for production:

    npm run build

Edit src/main.ts to customize the simulation. Enable debug visualization by calling setDebugMode(true) on any RigidBody instance, or toggle all through the UI.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published