# Melonjs Physics

Use this skill for collision, physics bodies, movement, and spatial queries in melonJS...

- Repository: https://github.com/melonjs/melonJS (6430 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add melonjs/melonJS --skill melonjs-physics -g -a claude-code -y`
Codex: `npx skills add melonjs/melonJS --skill melonjs-physics -g -a codex -y`
Cursor: `npx skills add melonjs/melonJS --skill melonjs-physics -g -a cursor -y`
Gemini CLI: `npx skills add melonjs/melonJS --skill melonjs-physics -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add melonjs/melonJS`

## Description

Use this skill for collision, physics bodies, movement, and spatial queries in melonJS, the built-in SAT world and the planck/matter adapters. Covers bodyDef vs Body, collision types and masks, the collision callback family and their firing rules, raycast/queryAABB/querySphere, the behaviour differences between adapters, and which one to pick for a given game. Triggers on: which physics engine, choosing an adapter, rotation collision, rotating body, torque, joints, stacking, Body, bodyDef, collision, collisionType, collisionMask, onCollision, onCollisionStart, onCollisionActive, raycast, queryAABB, querySphere, PlanckAdapter, MatterAdapter, gravity, velocity, applyForce, isGrounded, SAT.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Physics and collision

> melonJS has a built-in SAT collision world and two optional rigid-body
> adapters. Movement, collision callbacks and spatial queries all behave
> differently depending on which is active, and several of the differences fail
> silently.

## Choosing a world

| | when |
|---|---|
| **built-in** (default) | Arcade-style: platformers, top-down games. Fast, position-based, not Newtonian. |
| **`@melonjs/planck-adapter`** | Full rigid-body dynamics, stacking, joints, realistic restitution. |
| **`@melonjs/matter-adapter`** | Same class of thing, backed by matter-js. |

### Picking one

Start with the built-in. It is the default for a reason: no dependency, the
smallest bundle, and its position-based model is what most 2D games actually
want, a platformer's jump arc is a designed curve, not a simulated one, and
tuning gravity against a solver you are fighting is a bad afternoon.

**Move to an adapter when the game needs something the builtin cannot express**,
and these are the usual triggers:

The rest: https://github.com/melonjs/melonJS/blob/HEAD/packages/melonjs/skills/melonjs-physics/SKILL.md
