Crashcat
physics engine for javascript, built for games, simulations, and creative websites
Install / Use
/learn @isaac-mason/CrashcatREADME

> npm install crashcat
crashcat
crashcat is physics engine for javascript, built for games, simulations, and creative websites.
Features
- 🎯 rigid body simulation
- 📦 support for convex shapes, triangle mesh shapes, custom shapes
- 🔗 constraints with motors and springs (hinge, slider, distance, point, fixed, cone, swing-twist, six-dof)
- ⚡ continuous collision detection (ccd) for fast-moving objects
- 🎭 flexible collision filtering
- 🔧 hooks for listening to and modifying physics events
- 🌳 broadphase spatial acceleration with dynamic bvh
- 😴 rigid body sleeping
- 👻 sensor rigid bodies
- 🌲 pure javascript, written to be highly tree-shakeable, only pay for what you use
- 🔌 works with any javascript engine/library - babylon.js, playcanvas, three.js, or your own engine
API Documentation
This readme provides curated explanations, guides, and examples to help you get started with crashcat.
Auto-generated API documentation can be found at crashcat.dev/docs.
Changelog
See the CHANGELOG.md for a detailed list of changes in each version.
Examples
<table> <tr> <td align="center"> <a href="https://crashcat.dev/examples#example-shapes"> <img src="./examples/public/screenshots/example-shapes.png" width="180" height="120" style="object-fit:cover;"/><br/> Shapes </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-triangle-mesh"> <img src="./examples/public/screenshots/example-triangle-mesh.png" width="180" height="120" style="object-fit:cover;"/><br/> Triangle Mesh </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-ragdoll"> <img src="./examples/public/screenshots/example-ragdoll.png" width="180" height="120" style="object-fit:cover;"/><br/> Ragdoll </a> </td> </tr> <tr> <td align="center"> <a href="https://crashcat.dev/examples#example-kcc"> <img src="./examples/public/screenshots/example-kcc.png" width="180" height="120" style="object-fit:cover;"/><br/> Kinematic Character Controller </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-kcc-stress-test"> <img src="./examples/public/screenshots/example-kcc-stress-test.png" width="180" height="120" style="object-fit:cover;"/><br/> KCC Stress Test </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-floating-character-controller"> <img src="./examples/public/screenshots/example-floating-character-controller.png" width="180" height="120" style="object-fit:cover;"/><br/> Floating Character Controller </a> </td> </tr> <tr> <td align="center"> <a href="https://crashcat.dev/examples#example-pointer-ray"> <img src="./examples/public/screenshots/example-pointer-ray.png" width="180" height="120" style="object-fit:cover;"/><br/> Pointer Raycast </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-cluster"> <img src="./examples/public/screenshots/example-cluster.png" width="180" height="120" style="object-fit:cover;"/><br/> Cluster </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-cube-heap"> <img src="./examples/public/screenshots/example-cube-heap.png" width="180" height="120" style="object-fit:cover;"/><br/> Cube Heap </a> </td> </tr> <tr> <td align="center"> <a href="https://crashcat.dev/examples#example-ccd"> <img src="./examples/public/screenshots/example-ccd.png" width="180" height="120" style="object-fit:cover;"/><br/> Continuous Collision Detection </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-kinematic"> <img src="./examples/public/screenshots/example-kinematic.png" width="180" height="120" style="object-fit:cover;"/><br/> Kinematic Body </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-constraints"> <img src="./examples/public/screenshots/example-constraints.png" width="180" height="120" style="object-fit:cover;"/><br/> Constraints </a> </td> </tr> <tr> <td align="center"> <a href="https://crashcat.dev/examples#example-constraints-motors"> <img src="./examples/public/screenshots/example-constraints-motors.png" width="180" height="120" style="object-fit:cover;"/><br/> Constraint Motors </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-hinge-motor"> <img src="./examples/public/screenshots/example-hinge-motor.png" width="180" height="120" style="object-fit:cover;"/><br/> Hinge Motor </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-voxel-triangle-mesh"> <img src="./examples/public/screenshots/example-voxel-triangle-mesh.png" width="180" height="120" style="object-fit:cover;"/><br/> Voxel Triangle Mesh </a> </td> </tr> <tr> <td align="center"> <a href="https://crashcat.dev/examples#example-voxel-custom-shape"> <img src="./examples/public/screenshots/example-voxel-custom-shape.png" width="180" height="120" style="object-fit:cover;"/><br/> Voxel Custom Shape </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-restitution"> <img src="./examples/public/screenshots/example-restitution.png" width="180" height="120" style="object-fit:cover;"/><br/> Restitution </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-friction"> <img src="./examples/public/screenshots/example-friction.png" width="180" height="120" style="object-fit:cover;"/><br/> Friction </a> </td> </tr> <tr> <td align="center"> <a href="https://crashcat.dev/examples#example-conveyor-belt"> <img src="./examples/public/screenshots/example-conveyor-belt.png" width="180" height="120" style="object-fit:cover;"/><br/> Conveyor Belt </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-linear-damping"> <img src="./examples/public/screenshots/example-linear-damping.png" width="180" height="120" style="object-fit:cover;"/><br/> Linear Damping </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-angular-damping"> <img src="./examples/public/screenshots/example-angular-damping.png" width="180" height="120" style="object-fit:cover;"/><br/> Angular Damping </a> </td> </tr> <tr> <td align="center"> <a href="https://crashcat.dev/examples#example-gravity-factor"> <img src="./examples/public/screenshots/example-gravity-factor.png" width="180" height="120" style="object-fit:cover;"/><br/> Gravity Factor </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-mass-properties"> <img src="./examples/public/screenshots/example-mass-properties.png" width="180" height="120" style="object-fit:cover;"/><br/> Mass Properties </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-add-impulse-at-position"> <img src="./examples/public/screenshots/example-add-impulse-at-position.png" width="180" height="120" style="object-fit:cover;"/><br/> Add Impulse at Position </a> </td> </tr> <tr> <td align="center"> <a href="https://crashcat.dev/examples#example-cast-ray"> <img src="./examples/public/screenshots/example-cast-ray.png" width="180" height="120" style="object-fit:cover;"/><br/> Cast Ray </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-cast-shape"> <img src="./examples/public/screenshots/example-cast-shape.png" width="180" height="120" style="object-fit:cover;"/><br/> Cast Shape </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-collide-point"> <img src="./examples/public/screenshots/example-collide-point.png" width="180" height="120" style="object-fit:cover;"/><br/> Collide Point </a> </td> </tr> <tr> <td align="center"> <a href="https://crashcat.dev/examples#example-collide-shape"> <img src="./examples/public/screenshots/example-collide-shape.png" width="180" height="120" style="object-fit:cover;"/><br/> Collide Shape </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-sensor"> <img src="./examples/public/screenshots/example-sensor.png" width="180" height="120" style="object-fit:cover;"/><br/> Sensor </a> </td> <td align="center"> <a href="https://crashcat.dev/examples#example-object-layer-filtering"> <img src="./examples/public/screenshots/example-object-layer-filtering.png" width="180" height="120" style="object-fit:cover;"/><br/> Object Layer Filtering </a> </td> </tr> <tr> <td align="center"> <a href="https://crashcat.dev/examples#example-collision-filtering"> <img src="./examples/public/screenshots/example-collision-filtering.png" wid