physics-matter について
Matter.js 物理を扱う Phaser 4 開発者向けスキルです。剛体、拘束、複合体、衝突、タイルマップ連携を説明し、センサー、衝突フィルタリング、ポインタードラッグ、デバッグ設定も取り上げます。
主な機能
- 01スプライト、画像、カスタム剛体の作成
- 02重力、摩擦、速度、力の設定
- 03拘束、複合体、複合剛体の構築
- 04衝突イベント、センサー、フィルタリング
- 05タイルマップ物理とポインタードラッグ
活用シーン
- 01キャラクターや環境に剛体衝突を設定
- 02拘束でスプリング、ジョイント、チェーンを構築
- 03アイテムやトリガー領域を検出
- 04タイルマップの衝突を Matter の剛体に変換
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ phaserjs/ phaser --skill physics-matterインストール後、Claude Code で/physics-matterを入力して読み込まれたか確認します。
詳細
Matter.js 物理演算
Phaser 4 で Matter.js 物理演算をセットアップして使用する方法 -- 剛体、複合ボディ、制約、コンポジット、センサー、衝突フィルタリング、ポインタードラッグ、タイルマップ統合、デバッグレンダリングを備えたフルボディ物理演算。
主要なソースパス: src/physics/matter-js/MatterPhysics.js、src/physics/matter-js/World.js、src/physics/matter-js/Factory.js、src/physics/matter-js/MatterSprite.js、src/physics/matter-js/MatterImage.js、src/physics/matter-js/MatterGameObject.js、src/physics/matter-js/PointerConstraint.js、src/physics/matter-js/MatterTileBody.js、src/physics/matter-js/components/、src/physics/matter-js/events/、src/physics/matter-js/typedefs/
関連スキル: ../game-setup-and-config/SKILL.md、../sprites-and-images/SKILL.md、../physics-arcade/SKILL.md、../tilemaps/SKILL.md
クイックスタート
class GameScene extends Phaser.Scene {
create() {
// Matter sprite (dynamic, has animation support)
this.player = this.matter.add.sprite(400, 200, 'player');
this.player.setBounce(0.5);
this.player.setFriction(0.05);
// Matter image (dynamic, no animation)
const box = this.matter.add.image(300, 100, 'crate');
// Static body from raw shape
this.matter.add.rectangle(400, 580, 800, 40, { isStatic: true });
// Enable pointer dragging on all bodies
this.matter.add.mouseSpring();
this.cursors = this.input.keyboard.createCursorKeys();
}
update() {
if (this.cursors.left.isDown) {
this.player.setVelocityX(-5);
} else if (this.cursors.right.isDown) {
this.player.setVelocityX(5);
}
if (this.cursors.up.isDown && this.player.body.velocity.y > -0.1) {
this.player.setVelocityY(-10);
}
}
}
// Enable Matter physics in game config
const config = {
type: Phaser.AUTO,
width: 800,
height: 600,
physics: {
default: 'matter',
matter: {
gravity: { y: 1 },
enableSleeping: true,
debug: true,
setBounds: true // walls around canvas edges
}
},
scene: GameScene
};
const game = new Phaser.Game(config);
基本概念
シーンプラグイン (this.matter)
MatterPhysics クラスはシーンレベルのプラグインです。主要なプロパティ:
this.matter.add-- ボディ、制約、ゲームオブジェクトを作成するためのFactory(ワールドに自動追加されます)。this.matter.world-- エンジン、境界、デバッグレンダリングを管理するWorldインスタンス。EventEmitterを拡張します。this.matter.body/bodies/composite/composites/constraint-- 低レベルで使用するための Matter.js モジュールへの直接参照。this.matter.bodyBounds-- 視覚的な境界に基づいてボディを整列させるためのヘルパー。
ワールド (this.matter.world)
engine--MatterJS.Engineインスタンス。localWorld-- すべてのボディと制約を含むMatterJS.Worldコンポジット。enabled-- 真偽値。falseにするとシミュレーションが一時停止します。autoUpdate--true= 各ゲームステップでエンジンが更新されます。walls--{ left, right, top, bottom }境界壁ボディ (または null)。
ワールド設定 (MatterWorldConfig)
ゲームまたはシーン設定の physics.matter の下で渡されます:
| プロパティ | デフォルト | 目的 |
|---|---|---|
gravity | { x: 0, y: 1 } | 重力ベクトル。無効にするには false を設定 |
setBounds | false | true または { x, y, width, height, thickness, left, right, top, bottom } |
enableSleeping | false | 静止時にボディをスリープさせることを許可 |
positionIterations | 6 | 位置解決の精度 |
velocityIterations | 4 | 速度解決の精度 |
constraintIterations | 2 | 制約の安定性 |
timing.timeScale | 1 | 0 でフリーズ、0.5 でスローモーション |
autoUpdate | true | 各ゲームフレームで自動ステップ |
debug | false | true または MatterDebugConfig オブジェクト |
runner | {} | 固定タイムステップには runner.fps を使用 |
Matter ゲームオブジェクト
Phaser は物理演算対応のゲームオブジェクトクラスを 2 つと、任意のゲームオブジェクトに物理演算を追加する関数を提供します:
Phaser.Physics.Matter.Sprite-- すべての Matter コンポーネントでSpriteを拡張します。this.matter.add.sprite(x, y, key, frame, options)で作成します。アニメーションをサポートします。Phaser.Physics.Matter.Image-- すべての Matter コンポーネントでImageを拡張します。this.matter.add.image(x, y, key, frame, options)で作成します。アニメーションをサポートせず、より軽量です。MatterGameObject(world, gameObject, options)-- すべての Matter コンポーネントを既存のゲームオブジェクトに注入します。this.matter.add.gameObject(mySprite, options)で作成します。
MatterSprite と MatterImage はどちらも、テクスチャサイズに一致する矩形ボディがデフォルトです。上書きするには options.shape を渡します。
Matter コンポーネント (ミックスイン)
すべての Matter ゲームオブジェクトには、以下のコンポーネントメソッドがミックスインされています:
| コンポーネント | 主なメソッド |
|---|---|
| Velocity | setVelocity(x, y), setVelocityX(x), setVelocityY(y), getVelocity(), setAngularVelocity(v), getAngularVelocity(), setAngularSpeed(s), getAngularSpeed() |
| Force | applyForce(vec2), applyForceFrom(position, force), thrust(speed), thrustLeft(speed), thrustRight(speed), thrustBack(speed) |
| Bounce | setBounce(value) -- 反発係数、0 から 1 |
| Friction | setFriction(value, air?, fstatic?), setFrictionAir(value), setFrictionStatic(value) |
| Mass | setMass(value), setDensity(value), centerOfMass (ゲッター) |
| Gravity | setIgnoreGravity(bool) |
| Sensor | setSensor(bool), isSensor() |
| Static | setStatic(bool), isStatic() |
| Sleep | setToSleep(), setAwake(), setSleepThreshold(n), setSleepEvents(start, end) |
| Collision | setCollisionCategory(cat), setCollisionGroup(group), setCollidesWith(cats), setOnCollide(cb), setOnCollideEnd(cb), setOnCollideActive(cb), setOnCollideWith(body, cb) |
| SetBody | setRectangle(w, h, opts), setCircle(r, opts), setPolygon(r, sides, opts), setTrapezoid(w, h, slope, opts), setBody(config, opts), setExistingBody(body) |
| Transform | Matter ボディとゲームオブジェクト間の位置同期 |
一般的なパターン
セットアップとワールドの設定
// Runtime gravity and bounds
this.matter.world.setGravity(0, 2); // x, y, scale (default 0.001)
this.matter.world.disableGravity();
this.matter.world.setBounds(0, 0, 1600, 1200, 64, true, true, true, true);
this.matter.set60Hz(); // fixed timestep
this.matter.world.autoUpdate = false; // then manual: this.matter.step(16.666);
this.matter.pause(); // pause/resume
this.matter.resume();
Matter スプライトと画像の作成
const player = this.matter.add.sprite(200, 300, 'hero'); // default rect body matching texture
// Custom body shapes via options.shape
const ball = this.matter.add.image(400, 100, 'ball', null, { shape: { type: 'circle', radius: 24 } });
const hex = this.matter.add.sprite(300, 100, 'hex', null, { shape: { type: 'polygon', sides: 6, radius: 32 } });
const ship = this.matter.add.sprite(400, 200, 'ship', null, {
shape: { type: 'fromVerts', verts: '0 0 40 0 40 40 20 60 0 40' }
});
// PhysicsEditor shape data
const shapes = this.cache.json.get('shapes');
const enemy = this.matter.add.sprite(500, 200, 'enemy', null, { shape: shapes.enemy });
// Add Matter physics to an existing Game Object
const existingSprite = this.add.sprite(100, 100, 'box');
this.matter.add.gameObject(existingSprite, { restitution: 0.8 });
// existingSprite now has setVelocity, setBounce, etc.
ボディ設定オプション (MatterBodyConfig)
任意のファクトリメソッドの options パラメータとして、または Matter ゲームオブジェクトのオプションとして渡します:
label,isStatic,isSensor,angle(ラジアン),timeScale,ignoreGravity,ignorePointerdensity(デフォルト 0.001、質量を自動計算),mass,restitution(反発 0-1)friction(0-1),frictionAir(空気抵抗),frictionStatic(静止時の粘着性)slop(重なり許容値),chamfer(角を丸めるには{ radius: 5 })collisionFilter: { category: 0x0001, mask: 0xFFFFFFFF, group: 0 }onCollideCallback,onCollideEndCallback,onCollideActiveCallbackshape(ゲームオブジェクト用):{ type: 'circle', radius: 24 }または PhysicsEditor データ
速度、力、推力
sprite.setVelocity(3, -5); // units per step, not pixels/sec
sprite.setVelocityX(-3);
sprite.setAngularVelocity(0.05);
const vel = sprite.getVelocity(); // { x, y }
// Forces use very small values (0.01 - 0.1)
sprite.applyForce({ x: 0.05, y: 0 });
sprite.applyForceFrom(position, { x: 0.02, y: -0.02 });
// Directional thrust relative to body angle
sprite.thrust(0.05); // forward
sprite.thrustBack(0.05); // backward
sprite.thrustLeft(0.03); // strafe left
sprite.thrustRight(0.03); // strafe right
// Batch operations via this.matter
this.matter.setVelocity(arrayOfBodies, 2, -3);
this.matter.applyForce(arrayOfBodies, { x: 0.01, y: 0 });
制約 (ジョイントとバネ)
// constraint(bodyA, bodyB, length?, stiffness?, options?) -- aliases: joint, spring
const rigid = this.matter.add.constraint(bodyA, bodyB, 100, 1); // rigid joint
const spring = this.matter.add.constraint(bodyA, bodyB, 200, 0.02, { damping: 0.05 });
const pin = this.matter.add.constraint(bodyA, bodyB, 0, 0.9); // pin joint
// World constraint (one body pinned to world point)
this.matter.add.worldConstraint(body, 50, 0.5, { pointA: { x: 400, y: 100 } });
// Offset attachment points
this.matter.add.constraint(bodyA, bodyB, 80, 1, {
pointA: { x: 20, y: 0 }, // offset from bodyA center
pointB: { x: -20, y: 0 } // offset from bodyB center
});
this.matter.getConstraintLength(constraint); // distance between anchor points
this.matter.world.removeConstraint(constraint); // remove from world
コンポジット (スタック、チェーン、ソフトボディ)
// Stack of bodies in a grid
const stack = this.matter.add.stack(100, 100, 5, 4, 10, 10, (x, y) => {
return this.matter.bodies.rectangle(x, y, 40, 40);
});
// Image stack (grid of Matter Images)
const imageStack = this.matter.add.imageStack('crate', null, 100, 100, 5, 4, 5, 5);
// Chain bodies in a composite together
this.matter.add.chain(stack, 0.5, 0, -0.5, 0, { stiffness: 0.7 });
// Mesh (grid with constraints, optional cross braces)
this.matter.add.mesh(stack, 5, 4, true, { stiffness: 0.5 });
// Soft body (cols, rows, gaps, crossBrace, particleRadius, bodyOpts, constraintOpts)
this.matter.add.softBody(200, 100, 5, 5, 0, 0, true, 10, { friction: 0.1 }, { stiffness: 0.5 });
// Pre-built composites: newtonsCradle, car, pyramid
this.matter.add.newtonsCradle(300, 50, 5, 20, 200);
this.matter.add.car(400, 300, 120, 30, 25);
複合ボディ
複数のシェイプを 1 つのボディに結合します。最初のパーツが親になります。
const partA = this.matter.bodies.rectangle(0, 0, 60, 20);
const partB = this.matter.bodies.circle(0, -30, 15);
const compoundBody = this.matter.body.create({ parts: [partA, partB] });
// Attach to a Game Object
const player = this.matter.add.sprite(400, 200, 'hero');
player.setExistingBody(compoundBody);
パーツは位置、角度、速度を共有します。制約はパーツではなく親ボディを対象にする必要があります。
スリープシステム
静止しているボディはスリープしてシミュレーションをスキップできます。設定で enableSleeping: true が必要です。
if (body.isSleeping) { /* body is at rest */ }
sprite.setSleepThreshold(30); // lower = falls asleep faster (default 60)
sprite.setToSleep(); // force sleep
sprite.setAwake(); // force wake
sprite.setSleepEvents(true, true); // enable sleepstart/sleepend events
this.matter.world.on('sleepstart', (event, body) => { /* body slept */ });
this.matter.world.on('sleepend', (event, body) => { /* body woke */ });
センサー
センサーは衝突を検出しますが、物理的に反応しません。トリガーゾーン、ピックアップ、検出エリアなどに便利です。
const trigger = this.matter.add.rectangle(400, 300, 100, 100, { isSensor: true, isStatic: true });
sprite.setSensor(true); // toggle on Game Object
sprite.isSensor(); // check state
// Sensors fire normal collision events -- use collisionstart/end to detect entry/exit
衝突カテゴリとフィルタリング
Matter はビットマスクを使用します: category (このボディが属するグループ、2 の累乗)、mask (衝突するカテゴリ)、group (ショートカット: 同じ正の値 = 常に衝突、同じ負の値 = 決して衝突しない、0 = category/mask を使用)。
const PLAYER = this.matter.world.nextCategory(); // 0x0002 (32 max)
const ENEMY = this.matter.world.nextCategory(); // 0x0004
const GROUND = this.matter.world.nextCategory(); // 0x0008
player.setCollisionCategory(PLAYER);
player.setCollidesWith([ENEMY, GROUND]);
bullet.setCollisionCategory(0x0010);
bullet.setCollidesWith([ENEMY, GROUND]); // bullets skip player
// Collision groups: same negative = never collide with each other
const noCollide = this.matter.world.nextGroup(true);
spriteA.setCollisionGroup(noCollide);
spriteB.setCollisionGroup(noCollide);
// Via body config: collisionFilter: { category, mask, group }
// Batch: this.matter.setCollisionCategory([bodyA, bodyB], ENEMY);
衝突コールバック
// Per-body callbacks (on Matter Game Objects)
player.setOnCollide((pair) => { /* pair.bodyA, pair.bodyB */ });
player.setOnCollideEnd((pair) => { /* collision ended */ });
player.setOnCollideActive((pair) => { /* still colliding */ });
player.setOnCollideWith(enemy, (body, pair) => { /* hit specific body */ });
// Game Object-level events (emitted on the Game Object itself)
player.on('collide', (bodyA, bodyB, pair) => {});
player.on('collideEnd', (bodyA, bodyB, pair) => {});
タイルマップ統合
const map = this.make.tilemap({ key: 'level' });
const tileset = map.addTilesetImage('tiles', 'tiles-img');
const layer = map.createLayer('Ground', tileset, 0, 0);
layer.setCollisionByProperty({ collides: true }); // MUST set collision first
this.matter.world.convertTilemapLayer(layer); // creates MatterTileBody per colliding tile
// Uses Tiled collision shapes (rect, circle, polygon) if defined, otherwise tile bounds.
// Access: tile.physics.matterBody
// Individual tile: this.matter.add.tileBody(tile, { isStatic: true, friction: 0.5 });
// After map changes: this.matter.world.convertTiles([tile1, tile2]);
摩擦の種類
Matter.js には 3 つの独立した摩擦値があります:
sprite.setFriction(0.1); // dynamic: resistance during motion (0-1)
sprite.setFrictionStatic(0.5); // static: resistance before motion starts
sprite.setFrictionAir(0.05); // air: environmental drag (default 0.01)
sprite.setFriction(0.1, 0.02, 0.3); // set all three: dynamic, air, static
頂点からの複雑なシェイプ
// Create body from vertex string (concave shapes auto-decomposed)
const body = this.matter.add.fromVertices(400, 300, '0 0 40 0 40 40 20 60 0 40');
// Multiple vertex sets for complex shapes
const vertexSets = [
[{ x: 0, y: 0 }, { x: 40, y: 0 }, { x: 40, y: 40 }],
[{ x: 40, y: 40 }, { x: 20, y: 60 }, { x: 0, y: 40 }]
];
this.matter.add.fromVertices(300, 200, vertexSets);
ポインター制約 (マウス/タッチによるドラッグ)
// Enable click-and-drag on all Matter bodies
const pc = this.matter.add.mouseSpring({ stiffness: 0.2, damping: 0.1 });
pc.active = false; // disable temporarily
body.ignorePointer = true; // prevent specific body from being dragged
pc.stopDrag(); // release current drag programmatically
pc.destroy(); // remove entirely
// Drag events on the world
this.matter.world.on('dragstart', (body, part, constraint) => {});
this.matter.world.on('drag', (body, constraint) => {});
this.matter.world.on('dragend', (body, constraint) => {});
クエリ (レイキャストとヒットテスト)
const hits = this.matter.intersectPoint(pointer.x, pointer.y); // bodies at point
const contains = this.matter.containsPoint(body, x, y); // point-in-body test
const inRegion = this.matter.intersectRect(100, 100, 200, 200); // bodies in rect
const rayHits = this.matter.intersectRay(0, 300, 800, 300, 1); // raycast
const colliding = this.matter.intersectBody(playerBody); // body overlap
// Overlap with callbacks
this.matter.overlap(playerBody, enemyBodies, (bodyA, bodyB, info) => {
console.log('Overlapping', bodyA, bodyB);
});
デバッグレンダリング
// Enable debug with specific options (pass as debug property in matter config)
// Boolean flags: showBody, showStaticBody, showVelocity, showCollisions, showSensors,
// showJoint, showPositions, showBounds, showAxes, showAngleIndicator, showSleeping,
// showConvexHulls, showInternalEdges, renderFill, renderLine
// Color/style: lineColor, lineThickness, fillColor, staticLineColor, staticFillColor,
// sensorLineColor, jointColor, pinColor, springColor, anchorColor, positionColor
// Toggle debug at runtime
this.matter.world.drawDebug = false;
this.matter.world.debugGraphic.visible = false;
// Set render style on individual body or constraint
this.matter.world.setBodyRenderStyle(body, 0xff0000, 1, 2, 0x00ff00, 0.5);
this.matter.world.setConstraintRenderStyle(constraint, 0xffff00, 1, 2);
イベント
すべてのイベントは this.matter.world(EventEmitter を継承)で発行されます。
| イベント | コールバックシグネチャ | 発行タイミング |
|---|---|---|
'collisionstart' | (event, bodyA, bodyB) | 2 つのボディが最初に衝突を開始したとき |
'collisionactive' | (event, bodyA, bodyB) | 2 つのボディが依然として衝突しているとき |
'collisionend' | (event, bodyA, bodyB) | 2 つのボディが衝突を終了したとき |
'beforeupdate' | (event) | エンジンの更新ステップの前 |
'afterupdate' | (event) | エンジンの更新ステップの後 |
'beforeadd' | (event) | ボディまたはコンスタンツが追加される前 |
'afteradd' | (event) | ボディまたはコンスタンツが追加された後 |
'beforeremove' | (event) | ボディまたはコンスタンツが削除される前 |
'afterremove' | (event) | ボディまたはコンスタンツが削除された後 |
'dragstart' | (body, part, constraint) | ポインターがボディのドラッグを開始したとき |
'drag' | (body, constraint) | ポインターがボディをドラッグしているとき |
'dragend' | (body, constraint) | ポインターがボディのドラッグを停止したとき |
'sleepstart' | (event, body) | ボディがスリープ状態になったとき(setSleepEvents が必要) |
'sleepend' | (event, body) | ボディが起きたとき(setSleepEvents が必要) |
'pause' | なし | ワールドが一時停止したとき |
'resume' | なし | ワールドが再開したとき |
衝突イベントには event.pairs が含まれます -- bodyA、bodyB、衝突の深さ、法線を持つ衝突ペアオブジェクトの配列です。
API クイックリファレンス
this.matter.add(ファクトリー)
ゲームオブジェクト: sprite(x, y, key, frame?, opts?)、image(x, y, key, frame?, opts?)、gameObject(go, opts?)、tileBody(tile, opts?)
ボディ形状: rectangle(x, y, w, h, opts?)、circle(x, y, r, opts?)、polygon(x, y, sides, r, opts?)、trapezoid(x, y, w, h, slope, opts?)、fromVertices(x, y, verts, opts?)、fromPhysicsEditor(x, y, config, opts?)、fromSVG(x, y, xml, scale?, opts?)、fromJSON(x, y, config, opts?)
コンスタンツ: constraint(a, b, len?, stiff?, opts?)(エイリアス: joint、spring)、worldConstraint(body, len?, stiff?, opts?)、mouseSpring(opts?)(エイリアス: pointerConstraint)
コンポジット: stack(x, y, cols, rows, colGap, rowGap, cb)、imageStack(key, frame, x, y, cols, rows)、pyramid(...)、chain(composite, xA, yA, xB, yB, opts?)、mesh(composite, cols, rows, cross, opts?)、softBody(...)、car(x, y, w, h, wheelSize)、newtonsCradle(x, y, num, size, len)
this.matter(MatterPhysics) -- バッチおよびユーティリティ
pause()、resume()、set60Hz()、set30Hz()、step(delta?)、setVelocity(bodies, x, y)、setAngularVelocity(bodies, v)、applyForce(bodies, force)、applyForceFromAngle(bodies, speed, angle?)、containsPoint(body, x, y)、intersectPoint(x, y)、intersectRect(x, y, w, h, outside?)、intersectRay(x1, y1, x2, y2, width?)、intersectBody(body)、overlap(target, bodies?, cb?)、setCollisionCategory(bodies, value)、setCollisionGroup(bodies, value)、setCollidesWith(bodies, cats)、alignBody(body, x, y, align)
this.matter.world(World)
setBounds(x?, y?, w?, h?, thickness?, l?, r?, t?, b?)、setGravity(x?, y?, scale?)、disableGravity()、add(object)、remove(object, deep?)、removeConstraint(constraint)、convertTilemapLayer(layer, opts?)、convertTiles(tiles, opts?)、nextCategory()、nextGroup(isNonColliding?)、getAllBodies()、has(body)、pause()、resume()
this.matter 上の Matter.js モジュールへの直接参照
body(Matter.Body)、bodies(Matter.Bodies)、composite(Matter.Composite)、composites(Matter.Composites)、constraint(Matter.Constraint)、detector、query、pair、pairs、resolver、axes、bounds、svg、vector、vertices
注意点
- Force の値は非常に小さくなります。 Force には
0.01~0.1、velocity には1~15を使用してください。ピクセルベースではありません。 setBody/setRectangle/などはすべてのプロパティをリセットします -- mass、friction、collision filters、callbacks は消去されます。形状を変更した後は再適用してください。- Constraints は複合ボディの
partsではなく、親ボディを対象にする必要があります。 - 衝突カテゴリは最大 32 個です。 各
nextCategory()は 1 ビットを使用します。 collisionFilter.groupは category/mask を上書きします。 同じ正の値 = 常に衝突、同じ負の値 = 決して衝突しない、ゼロ/異なる値 = category/mask を使用。- センサーもイベントを発火させるには一致する collision filters が必要です。
- Matter の位置は重心であり、左上ではありません(Arcade Physics とは異なります)。
- Sleep イベントはオプトインが必要です:
sprite.setSleepEvents(true, true)。 - Tilemap の変換には、まず collision を設定する必要があります --
setCollisionByPropertyなどを使用します。 - Restitution は
Math.max(bodyA.restitution, bodyB.restitution)を使用します -- より弾む値が優先されます。 body.ignorePointer = trueは、ポインタ制約がそのボディをドラッグするのを防ぎます。
ソースファイルマップ
| パス | 目的 |
|---|---|
src/physics/matter-js/MatterPhysics.js | シーンプラグイン (this.matter)、すべての Matter モジュールを公開 |
src/physics/matter-js/World.js | ワールド管理、エンジン、境界、デバッグ、イベントプロキシ |
src/physics/matter-js/Factory.js | this.matter.add -- すべての作成メソッド |
src/physics/matter-js/MatterSprite.js | 物理スプライト (Sprite + Matter コンポーネント) |
src/physics/matter-js/MatterImage.js | 物理イメージ (Image + Matter コンポーネント) |
src/physics/matter-js/MatterGameObject.js | 任意のゲームオブジェクトに Matter コンポーネントを注入 |
src/physics/matter-js/MatterTileBody.js | タイルを Matter ボディでラップ |
src/physics/matter-js/PointerConstraint.js | クリックアンドドラッグのボディ制約 |
src/physics/matter-js/BodyBounds.js | 視覚的境界によるボディの位置合わせ |
src/physics/matter-js/PhysicsEditorParser.js | PhysicsEditor の JSON をボディにパース |
src/physics/matter-js/components/ | ミックスイン: Velocity、Force、Collision、SetBody、Sensor、Bounce、Friction、Mass、Gravity、Static、Sleep、Transform |
src/physics/matter-js/events/ | イベント定数 (COLLISION_START、DRAG_START、SLEEP_START など) |
src/physics/matter-js/typedefs/ | TypeDefs: MatterWorldConfig、MatterBodyConfig、MatterCollisionFilter、MatterConstraintConfig など |
src/physics/matter-js/lib/ | バンドルされた Matter.js ライブラリモジュール |